I am trying to import some schemas from a project which are in zip format. The name of the file is mySchema-1.0.32-schema.zip
. My dependency looks like:
<dependency>
<groupId>some.group.id</groupId>
<artifactId>mySchema</artifactId>
<version>${schema.version}</version>
<classifier>schema</classifier>
<type>zip</type>
</dependency>
But the dependency does not get imported. It is in my repo (I have checked), and I have the source dependency for the same project and it works just fine. Are my classifier and my type right? Is this the way to import a zip
file?
EDIT:
I've found out that if I change the <classifier>
to source
it does import the sources, and if I change it to -schemas
it spits out an error. Hence, the import seems to be working. And although I can't see it in my list of dependencies in IntelliJ IDEA, if I run mvn dependency:tree
, it exists there:
\- some.group.id:mySchema:zip:schema:1.0.32-SNAPSHOT:compile
It might be my unzipping that is not working:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>some.group.id</groupId>
<artifactId>mySchema</artifactId>
<version>${schema.version}</version>
<classifier>schema</classifier>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${basedir}/src/main/resources/json</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
And just to clarify, my output directory exists.
Found the solution. Added this plugin under the
<build>
section: