Im trying to setup what I think is a simple assembly, taking the jars from several modules and putting them in a specific folder inside a zip. The resulting assembly should look like so:
ir4job\
ir4job\app_lib\
ir4job\app_lib\ jar files go here
But maven is giving me an empty zip file when the assembly is generated
Assembly descriptor:
<assembly>
<!-- ir4job folder contents -->
<id>ir4job-app</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<binaries>
<dependencySets>
<dependencySet>
<outputDirectory>ir4job/app_lib</outputDirectory>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
pom file:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>glb</groupId>
<artifactId>Release</artifactId>
<packaging>pom</packaging>
<name>release</name>
<version>1.0</version>
<parent>
.... parent info ....
</parent>
<dependencies>
... various dependencies ...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>ir4job-app.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>do-release</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Im pretty sure I missed something simple here... what is it?
At first glance, it seems you are missing the filesets to include. For example:
<assembly>
<id>ir4job-app</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>path/to/folder/relative/to/project/root/ir4job/app_lib</directory>
<outputDirectory>ir4job/app_lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
You will need a fileset for each directory you want to include (unless they fall under the same parent directory). The syntax for that is something like:
...
<includeBaseDirectory>true</includeBaseDirectory>
....
<fileSet>
<directory>path/to/folder/relative/to/project/root/ir4job</directory>
<includes>
<include>**/*.jar</include>
</includes>
</fileSet>
...
edit #1:
Working example of using the maven-dependency-plugin to copy dependencies to a folder:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies-for-assembly</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/libs</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
Note: you can also limit the dependencies that get copied using configuration options such as
...
<configuration>
...
<includeGroupIds>com.mycompany,org.springframework,org.hibernate</includeGroupIds>
</configuration>
...
You can also limit by artifactId, classifier, etc.
edit #2:
The better answer is probably just to pull your dependencySet tag up a couple levels as in:
<assembly>
<!-- ir4job folder contents -->
<id>ir4job-app</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>ir4job/app_lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>