This short post decribes how to create a release zip file from a module based Maven build.
Create a release
directory next to your parent pom.xml
file.
Add a pom.xml
file inside the release
directory and link it to the parent:
<parent>
<groupId>de.datenkollektiv.util</groupId>
<artifactId>parent</artifactId>
<version>0.8.15</version>
<relativePath>..</relativePath>
</parent>
And configure the maven-assembly-plugin
in the build/plugins
section of your build file.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
<executions>
<!-- w/o dependencies -->
<execution>
<id>wo-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/no-dependencies.xml</descriptor>
</descriptors>
<attach>false</attach>
</configuration>
</execution>
</executions>
</plugin>
The referenced no-dependencies.xml
assembly descriptor contains the assembly instructions:
<assembly>
<id>no-dependencies</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<moduleSets>
<!-- mandatory jars -->
<moduleSet>
<includes>
<include>de.datenkollektiv.util:diceroller</include>
</includes>
<!-- the .jar and -sources.jar will be included here -->
<sources>
<includeModuleDirectory>false</includeModuleDirectory>
<fileSets>
<fileSet>
<directory>target</directory>
<outputDirectory>dist</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
</assembly>
More information can be found in the Guide to creating assemblies and Including Module Binaries.