Skip to content

Instantly share code, notes, and snippets.

@ruseel
Created August 20, 2013 00:25
Show Gist options
  • Save ruseel/6275744 to your computer and use it in GitHub Desktop.
Save ruseel/6275744 to your computer and use it in GitHub Desktop.
maven assembly plugin
<assembly>
<!-- this will create an extra resource project-1.1.1-package.zip, you can
choose jar as well in the format-->
<id>package</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<!-- Insert here extra files as configs or, batch files, resources, docs etc-->
<fileSets>
<fileSet>
<directory>src/main/assembly/files</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/bin/*</include>
<include>**/conf/*.*</include>
<include>**/doc/*.*</include>
</includes>
</fileSet>
</fileSets>
<!-- This will scrub your dependencies and add them to your lib folder, I excluded
Test stuff as it is not needed, could have declared the resource as a test
only phase as well would not have had to exclude it here
-->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>junit:junit</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!--I recommend 2.1 as later versions have a bug that may Duplicate files
in your archive -->
<version>2.1</version>
<!--Executes the packaging along with the mvn package phase -->
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<!--Relative path to your descriptor -->
<descriptor>src/main/assembly/package.xml
</descriptor>
</descriptors>
</configuration>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment