I have a project which is using a maven assembly plugin to include a bunch of files into a tar. Now I want to include a few more files in that tar, but first I want to zip them up and actually include that zip file.
I tried doing something like this: maven-assembly plugin - how to create nested assemblies
So basically created 2 executions inside the maven assempbly plugin and have the first execution create the required zip file that the second execution can package into a tar.
But I get the error saying the zip file 'is not a file'.
What is wrong with what I am doing?
Is there a more efficient way to do this?
This is what I tried:
My POM:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>create-tar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>tar.xml</descriptor>d
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
zip.xml
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip-id</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/resources/vertica_schema/schema_migrations</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
tar.xml
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly- plugin/assembly/1.1.2"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>tar-id</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>/*.zip</source>
<outputDirectory>/lib</outputDirectory>
<destName>schema_migrations.zip</destName>
</file>
</files>