Skip to content

Instantly share code, notes, and snippets.

@prb
Created May 12, 2014 16:47
Show Gist options
  • Save prb/d776a47bd164f704eecb to your computer and use it in GitHub Desktop.
Save prb/d776a47bd164f704eecb to your computer and use it in GitHub Desktop.
Fragment of a pom.xml file for packaging separate worker and driver JARs for Spark.
<!-- Fragment of pom.xml -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<id>job-driver-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>driver</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<!--
Some care is required:
http://doc.akka.io/docs/akka/snapshot/general/configuration.html
-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>foo.bar.SparkJobs</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
<execution>
<id>worker-library-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>worker</shadedClassifierName>
<artifactSet>
<includes>
<!-- Fill in what you'd need here. -->
<include>com.fasterxml.jackson.core:*</include>
<include>com.fasterxml.jackson.datatype:*</include>
<include>com.fasterxml.jackson.module:*</include>
<include>org.joda:joda-convert</include>
<include>joda-time:joda-time</include>
</includes>
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment