Skip to content

Instantly share code, notes, and snippets.

@blalor
Created January 26, 2013 14:36
Show Gist options
  • Save blalor/4642746 to your computer and use it in GitHub Desktop.
Save blalor/4642746 to your computer and use it in GitHub Desktop.
Vert.x assembly for Maven

This is sample configuration to help you build a Vert.x "mod" archive. Put mod.xml into your project as src/main/assembly/mod.xml and the include the maven-assembly-plugin plugin config in your pom.xml. Also create src/main/resources/mod.json. When you run mvn package you will get target/${artifactId}-${version}-mod.zip which will contain all of your dependencies in ${groupId}.${artifactId}-v${version}/lib and ${groupId}.${artifactId}-v${version}/mod.json. Your application code and resources will be in ${groupId}.${artifactId}-v${version}/lib/${artifactId}-${version}.jar.

<!--
Assembly descriptor
-->
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>mod</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory>${project.groupId}.${project.artifactId}-v${project.version}</baseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<!-- empty outputDirectory puts mod.json at the root of the structure -->
<outputDirectory></outputDirectory>
<directory>src/main/resources</directory>
<includes>
<include>mod.json</include>
</includes>
</fileSet>
</fileSets>
</assembly>
<!--
partial Maven pom referencing the assembly plugin
-->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<!-- == provided == -->
<dependency>
<groupId>org.vert-x</groupId>
<artifactId>vertx-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.vert-x</groupId>
<artifactId>vertx-platform</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/mod.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment