Module Targets

The following build targets are available in the standard Ant buildfile of every module, excluding the targets provided by plugins. Click a target name to get more detailed information about it.

Target Summary
Plugin targets... Additional module-level build targets added by Antmod's build plugins.
build Builds all sources, and generates jar
clean Removes all build results.
cleandist Removes distribution resources and build results related to 'dist' only.
createbranch Create a new branch with a new version number (using promoteversion); requires the current checkout to be the "trunk".
debug When invoked before 'dist', this will disable obfuscation.
dist Create distribution resources for external distribution.
listversions List all versions in the currently checked out branch of this module.
mergetobranch Merge and commit trunk changes to the latest branch.
mergetotrunk Merge and commit branch changes to the trunk.
pickversion Pick a specific version for this module without having to change the release descriptor.
promotetobranch Do mergetobranch and promote the version of the latest branch.
promoteversion Promotes version of currently checked out branch.
verbose When invoked before 'build', this will generate verbose javac output.

build

Builds the sources, and generates class files, jar files, etcetera in the "build/" (antmod.module.dirs.build) directory.

Two jars are generated by default: "build/jar/modulename.jar" and "build/jar/modulename-resources.jar". The resources jar contains all non .java files that were found in the source directory. This makes those non-java files available on the classpath during runtime.

As part of the build, optionally hibernate mapping are generated by the hibernate plugin. Also, the junit test classes are compiled as well for the junit plugin.

clean

Cleans all build resources, by doing the following:

  • deleting the "build/" (antmod.module.dirs.build) directory
  • clearing the last-build timestamp to force a build next time
  • deleting temporary files: filenames ending with "~" left by editors like vi

cleandist

Cleans all dist related resources, without removing other build results. It does this by:

  • deleting the "build/dist/" (antmod.module.dirs.build.dist) directory only

createbranch

Creates a new branch in the "trunk" of the module. If the module is currently not checked out as with version "trunk", this command will fail.

The "createbranch" target will increment the latest known 2-digit version number. If no version was known yet, version "1-0" is created.

The "createbranch" target uses the promoteversion build target.

debug

Enables debugging flags for the distribution; is only useful when combined with other commands. More specifically this will disable obfuscation when this command is combined with the dist command.

Example: ant debug dist

dist

Generates distribution contents for this module.

By default, the module "dist" target does the following:

  • depends on the module "build" target, which is executed first
  • copies all files in the "resources/dist/" (antmod.module.dirs.resources.dist) directory to the "build/dist/" (antmod.module.dirs.build.dist) directory, where it is picked up by the release "dist" target

Note: the module "dist" target is only used by the release "dist" target if the module type is set to 'main', 'buildrelease' or 'dist'.

listversions

Lists the available versions in the currently checked out branch of this module.

Sample output:

~/dev/petshop-1.1.2/shoppingbasket $ ant listversions
Buildfile: build.xml

Antmod:
    [echo] Module 'shoppingbasket' currently has local version 'trunk'.

    [echo] The versions in the current branch of 'shoppingbasket' are:
    [echo] 1-2, 1-1, 1-0

mergetobranch

Merges and commits the committed changes in the trunk of the current module to the latest branch. Mostly useful if no changes were applied in the branch yet, and a few small trunk changes need to be merged to that branch.

For example: the latest branch is "1.20", and a few changes have been committed in the trunk since. Running "ant mergetobranch" while the "trunk" is checked out, will merge and commit the changes from the trunk to the "1.20" branch.

This target works like this: it does a temporary checkout of the latest branch of the modulet in the directory ${antmod.local.dir}, merges the trunk changes to that checkout and commits the changes. If any kind of conflict is found this is reported and this target aborts.

mergetotrunk

Merges and commits the committed changes in the currently checked out branch of the current module to the trunk.

This target works the same as mergetobranch, except that it now merges changes from the checked out branch to the trunk of the module.

pickversion

Allows you to change the checked out version of the module, without having to edit the release descriptor and having to do an "ant update" in the release directory.

Sample output:

~/dev/petshop-1.1.2/shoppingbasket $ ant pickversion
Buildfile: build.xml

Antmod:
    [echo] Module 'shoppingbasket' currently has local version 'trunk'.

    [input] To which version do you want to change?
1.2

    [scm] Changing existing checkout of "shoppingbasket" from version "trunk" to "1-2"
    [scm] A  shoppingbasket/src
    [scm] A  shoppingbasket/src/java
    [scm] Checked out revision 7421.

    [echo] Now module 'shoppingbasket' has version: 1-2.

promotetobranch

Merges, commits and promotes committed trunk changes to the latest branch of the module.

This target first executes mergetobranch, and then promotes the version of the latest branch.

For example: if trunk changes since latest branch "1.20" are processed using this target, they are merged and committed to the "1.20" branch. If the latest tag in this branch was "1.20.3", the merged trunk changes would become available under version "1.20.4" after running this "promotetobranch" target.

promoteversion

Promotes the version of the module. The currently checked out version of the module has to be either the "trunk" or a 2-digit version (a branch). Otherwise this target will fail.

If the currently checked out version is the "trunk":

  • this is the same as what the createbranch target would do
  • the latest 2-digit version number is retrieved
  • changes are checked: if nothing changed since this last version number in the trunk, this will be detected for you!
  • the 2nd digit of the latest version number is increased, so "1.7" would be increased to "1.8"
  • confirmation is asked for creating the new branch
  • an initial ".0" tag is created in the branch, so for a new "1.8" branch, a "1.8.0" tag would be created immediately

If the currently checked out version is a 2-digit version (a branch):

  • the latest 3-digit version number (being a tag in the branch) is retrieved
  • changes are checked: if nothing changed since this last tag was created in the branch, this will be detected for you!
  • the 3rd digit of the latest version number is increased, so "1.7.3" would be increased to "1.7.4"
  • confirmation is asked for creating the new tag

verbose

Enables verbose flags for the build target; is only useful when combined with other commands. More specifically this will enable verbose javac output, by setting the antmod.javac.verbose variable to true, which is picked up by the default implementation of the build target.

Example: ant verbose build