Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit ab19772

Browse files
committed
Push more configuration out to project.properties.
1 parent feb3cc3 commit ab19772

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

Diff for: build.xml

+10-11
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
xmlns:ivy="antlib:org.apache.ivy.ant">
44

55
<!-- Project-specific configuration -->
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"/>
6+
<loadproperties srcfile="project.properties" />
97
<property name="main.class" value="${package.main}.${ant.project.name}"/>
10-
<property name="jar.file" value="${ant.project.name}.jar"/>
8+
<property name="base.name" value="${artifactId}-${version}"/>
119

1210
<!-- Standard Directory Layout -->
1311
<property name="src.dir" value="src"/>
@@ -53,7 +51,7 @@
5351

5452
<target name="jar" depends="compile"
5553
description="Generate the jarfile distributable.">
56-
<jar destfile="${dist.dir}/${jar.file}" basedir="${build.classes.dir}">
54+
<jar destfile="${dist.dir}/${base.name}.jar" basedir="${build.classes.dir}">
5755
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
5856
<manifest>
5957
<attribute name="Main-Class" value="${main.class}"/>
@@ -163,14 +161,15 @@
163161
<target name="bundle" depends="jar,javadoc"
164162
description="Stage a Maven repository bundle.">
165163
<!-- 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">
164+
<filter filtersfile="project.properties"/>
165+
<filter token="ant.project.name" value="${ant.project.name}"/>
166+
<copy file="pom.xml" filtering="true"
167+
tofile="${dist.dir}/bundle/${base.name}.pom"/>
168+
<copy file="${dist.dir}/${base.name}.jar" todir="${dist.dir}/bundle/"/>
169+
<jar jarfile="${dist.dir}/bundle/${base.name}-javadoc.jar">
171170
<fileset dir="${dist.dir}/javadoc"/>
172171
</jar>
173-
<jar jarfile="${dist.dir}/bundle/${artifactId}-${version}-sources.jar">
172+
<jar jarfile="${dist.dir}/bundle/${base.name}-sources.jar">
174173
<fileset dir="${src.dir}"/>
175174
</jar>
176175
<!-- Sign all the things. You'll need gpg-agent help here. -->

Diff for: pom.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<project>
22
<modelVersion>4.0.0</modelVersion>
3-
<groupId>com.nullprogram</groupId>
4-
<artifactId>sample-java-project</artifactId>
5-
<version>1.0-SNAPSHOT</version>
3+
<groupId>@groupId@</groupId>
4+
<artifactId>@artifactId@</artifactId>
5+
<version>@version@</version>
66
<packaging>jar</packaging>
77

8-
<name>SampleJavaProject</name>
9-
<description>An Ant-based sample Java project.</description>
10-
<url>http://nullprogram.com/blog/2010/10/04/</url>
8+
<name>@ant.project.name@</name>
9+
<description>@description@</description>
10+
<url>@project.url@</url>
1111

1212
<licenses>
1313
<license>
@@ -19,9 +19,9 @@
1919

2020
<scm>
2121
<connection>
22-
scm:git:https://github.com/skeeto/SampleJavaProject.git
22+
scm:git:@project.repo.url@
2323
</connection>
24-
<url>https://github.com/skeeto/SampleJavaProject</url>
24+
<url>@project.scm.url@</url>
2525
</scm>
2626

2727
<developers>

Diff for: project.properties

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Project information
2+
artifactId = sample-java-project
3+
description = An Ant-based sample Java project.
4+
version = 1.0-SNAPSHOT
5+
package.main = sample.java.project
6+
7+
# External information
8+
groupId = com.nullprogram
9+
project.url = http://nullprogram.com/blog/2010/10/04/
10+
project.repo.url = https://github.com/skeeto/SampleJavaProject.git
11+
project.scm.url = https://github.com/skeeto/SampleJavaProject

0 commit comments

Comments
 (0)