Skip to content

Commit 18e70cb

Browse files
committed
Add target for creating Maven bundles.
1 parent 6b527ee commit 18e70cb

2 files changed

Lines changed: 64 additions & 2 deletions

File tree

build.xml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
xmlns:ivy="antlib:org.apache.ivy.ant">
44

55
<!-- Project-specific configuration -->
6-
<property name="package" value="sample.java.project"/>
7-
<property name="main.class" value="${package}.${ant.project.name}"/>
6+
<property name="artifactId" value="sample-java-project"/>
7+
<property name="version" value="1.0-SNAPSHOT"/>
8+
<property name="package.main" value="sample.java.project"/>
9+
<property name="main.class" value="${package.main}.${ant.project.name}"/>
810
<property name="jar.file" value="${ant.project.name}.jar"/>
911

1012
<!-- Standard Directory Layout -->
@@ -155,4 +157,29 @@
155157
</batchtest>
156158
</junit>
157159
</target>
160+
161+
<!-- Maven repository support -->
162+
163+
<target name="bundle" depends="jar,javadoc"
164+
description="Stage a Maven repository bundle.">
165+
<!-- Pack up the artifacts -->
166+
<copy file="pom.xml"
167+
tofile="${dist.dir}/bundle/${artifactId}-${version}.pom"/>
168+
<copy file="${dist.dir}/${jar.file}"
169+
tofile="${dist.dir}/bundle/${artifactId}-${version}.jar"/>
170+
<jar jarfile="${dist.dir}/bundle/${artifactId}-${version}-javadoc.jar">
171+
<fileset dir="${dist.dir}/javadoc"/>
172+
</jar>
173+
<jar jarfile="${dist.dir}/bundle/${artifactId}-${version}-sources.jar">
174+
<fileset dir="${src.dir}"/>
175+
</jar>
176+
<!-- Sign all the things. You'll need gpg-agent help here. -->
177+
<apply executable="gpg">
178+
<arg value="--detach-sign"/>
179+
<arg value="--armor"/>
180+
<fileset dir="${dist.dir}/bundle"/>
181+
</apply>
182+
<!-- Pack it all up -->
183+
<jar destfile="${dist.dir}/bundle.jar" basedir="${dist.dir}/bundle"/>
184+
</target>
158185
</project>

pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.nullprogram</groupId>
4+
<artifactId>sample-java-project</artifactId>
5+
<version>1.0-SNAPSHOT</version>
6+
<packaging>jar</packaging>
7+
8+
<name>SampleJavaProject</name>
9+
<description>An Ant-based sample Java project.</description>
10+
<url>http://nullprogram.com/blog/2010/10/04/</url>
11+
12+
<licenses>
13+
<license>
14+
<name>The Unlicense</name>
15+
<url>http://unlicense.org/UNLICENSE</url>
16+
<distribution>repo</distribution>
17+
</license>
18+
</licenses>
19+
20+
<scm>
21+
<connection>
22+
scm:git:https://github.com/skeeto/SampleJavaProject.git
23+
</connection>
24+
<url>https://github.com/skeeto/SampleJavaProject</url>
25+
</scm>
26+
27+
<developers>
28+
<developer>
29+
<name>Christopher Wellons</name>
30+
<email>mosquitopsu@gmail.com</email>
31+
<url>http://nullprogram.com</url>
32+
<timezone>-5</timezone>
33+
</developer>
34+
</developers>
35+
</project>

0 commit comments

Comments
 (0)