Skip to content

Commit df4da60

Browse files
committed
Merge pull request apache#56 from Shopify/package_with_java_6
Package with java 6
2 parents 4bc6653 + 2e1638d commit df4da60

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

assembly/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<spark.jar.dir>scala-${scala.binary.version}</spark.jar.dir>
3737
<spark.jar.basename>spark-assembly-${project.version}-hadoop${hadoop.version}.jar</spark.jar.basename>
3838
<spark.jar>${project.build.directory}/${spark.jar.dir}/${spark.jar.basename}</spark.jar>
39+
<spark.shaded.dir>${project.build.directory}/${spark.jar.dir}/shaded</spark.shaded.dir>
40+
<spark.shaded.jar>${spark.shaded.dir}/${spark.jar.basename}</spark.shaded.jar>
41+
<spark.shaded.unjar>${spark.shaded.dir}/unjar</spark.shaded.unjar>
3942
</properties>
4043

4144
<dependencies>
@@ -243,5 +246,43 @@
243246
<parquet.deps.scope>provided</parquet.deps.scope>
244247
</properties>
245248
</profile>
249+
<!-- Profiles that enable repackaging assembly jar. -->
250+
<profile>
251+
<id>repackage</id>
252+
<build>
253+
<plugins>
254+
<plugin>
255+
<artifactId>maven-antrun-plugin</artifactId>
256+
<executions>
257+
<execution>
258+
<id>java6-package</id>
259+
<phase>package</phase>
260+
<goals>
261+
<goal>run</goal>
262+
</goals>
263+
<configuration>
264+
<tasks if="jar.tool">
265+
<mkdir dir="${spark.shaded.unjar}"/>
266+
<echo message="Unjar ${spark.jar} to ${spark.shaded.unjar}"/>
267+
<unzip src="${spark.jar}" dest="${spark.shaded.unjar}"/>
268+
<echo message="move original ${spark.jar} to ${spark.shaded.jar} ."/>
269+
<copy file="${spark.jar}" tofile="${spark.shaded.jar}"/>
270+
<echo message="Jar file to ${spark.jar} -C ${spark.shaded.unjar} . with tool ${jar.tool}"/>
271+
<exec executable="${jar.tool}">
272+
<arg value="cf"/>
273+
<arg value="${spark.jar}"/>
274+
<arg value="-C"/>
275+
<arg value="${spark.shaded.unjar}"/>
276+
<arg value="."/>
277+
</exec>
278+
<delete dir="${spark.shaded.unjar}"/>
279+
</tasks>
280+
</configuration>
281+
</execution>
282+
</executions>
283+
</plugin>
284+
</plugins>
285+
</build>
286+
</profile>
246287
</profiles>
247288
</project>

script/compile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ else
2323
fi
2424
export JAVA_HOME=$JAVA_HOME
2525

26-
./make-distribution.sh --skip-java-test $(cat SHOPIFY_HADOOP_OPTIONS)
26+
./make-distribution.sh --skip-java-test $(cat SHOPIFY_HADOOP_OPTIONS) -Prepackage -Djar.tool=/u/apps/packserv/java_alt/bin/jar
2727

2828
if [ "$?" != "0" ] || [ -e "$FWDIR/lib/spark-assembly*hadoop*.jar" ]; then
2929
echo "Failed to make spark distro using sbt."

0 commit comments

Comments
 (0)