1+ # Sample Java Project
2+
13This is a reference for setting up a new Ant-based Java project. It
24contains most of the little Ant tricks I've learned over the
35years. When I start a new Java project I clone this repository, remove
46sections of build.xml that I don't care about for that particular
57project, set the project properties, clear out the sample sources, and
68get to work.
79
10+ ## Setup
11+
812Building this project requires that Ivy be available to Ant. All you
9- need is ivy.jar in Ant's classpath (in your $CLASSPATH, $ANT_HOME/lib,
10- or ~/.ant/lib).
13+ need is ivy.jar in Ant's classpath (in your ` $CLASSPATH ` ,
14+ ` $ANT_HOME/lib ` , or ` ~/.ant/lib ` ).
15+
16+ ## Dependencies
1117
1218You will need to have Astyle installed and in your path for the
1319"format" target to work. If it's missing, that's fine. It won't affect
1420any other targets.
1521
16- Ant will be looking for Checkstyle if you try to use the "check"
17- target. Like a hardcore bureaucrat, Checkstyle will harshly criticize
18- any stylistic mistakes and missing documentation, requiring you to dot
19- every "i" and cross every "t". That can keep idle hands pretty busy.
20-
21- Ant will be looking for ProGuard if you try to use the "optimize"
22- target. This tool does a bytecode analysis to shorten (and obfuscate)
23- identifiers and remove unreachable code.
24-
2522There is a "hotswap" target for replacing live code while an
2623application is running. You'll need the hotswap Ant extension
2724installed to use it. This target is to be used alongside the
@@ -31,26 +28,25 @@ the printed string in the code, and running "hotswap" in another
3128terminal. The printed message in the running program should change to
3229the new string.
3330
34- Note that ProGuard, hotswap, Ivy, and Checkstyle are needed only in
35- the build classpath, not your project's classpath. That means you
36- probably don't want them in lib/. They should be where Ant can get to
37- them, not your project.
31+ ## Bundles
3832
39- Take note of the sample pom.xml file. This is not actually for Maven
33+ Take note of the sample ` pom.xml ` file. This is not actually for Maven
4034builds -- this is an Ant project afterall -- but for publishing builds
4135for a Maven repository. It's packed up by the "bundle" target, which
42- creates a bundle.jar containing your project's signed artifacts. To
36+ creates a ` bundle.jar ` containing your project's signed artifacts. To
4337use the "bundle" target you need to have GnuPG set up in your path, a
44- generated key pair, and a running gpg-agent, unless you like typing
38+ generated key pair, and a running ` gpg-agent ` , unless you like typing
4539your passphrase a bunch of times in a row.
4640
41+ ## Philosophy
42+
4743I hate coding absolute paths in my build script and I hate including
4844built files as part of the base project. My philosophy is that the
4945* environment* should be set up so that the tool can easily find the
50- external resources they need (JUnit, etc.) from the system, not within
51- the project . It's the system or dependency manager that provides the
52- libraries. Anyone who has the proper development environment set up --
53- one that works across many projects -- should be able to clone the
54- repository and do a build simply by running the build program with no
55- special arguments. There should be no need to edit or install anything
56- into the project space for the initial build.
46+ external resources they need (JUnit, etc.) from the system or
47+ dependency manager . It's the system or dependency manager that
48+ provides the libraries. Anyone who has the proper development
49+ environment set up -- one that works across many projects -- should be
50+ able to clone the repository and do a build simply by running the
51+ build program with no special arguments. There should be no need to
52+ edit or install anything into the project space for the initial build.
0 commit comments