The following build targets are available in the standard Ant buildfile of every release, excluding the targets provided by plugins. Click a target name to get more detailed information about it.
| Target | Summary |
|---|---|
| Plugin targets... | Additional release-level build targets added by Antmod's build plugins. |
| build | Builds all sources, and generates jar, for each module in the release. |
| clean | Removes all build results. |
| cleandist | Removes distribution resources and build results related to 'dist' only. |
| debug | When invoked before 'dist', this will disable obfuscation. |
| deploy | Deploy the release. By default this is a placeholder target, the 'buildrelease' or 'main' module can implement this in its 'local.build.xml'. |
| dist | Create distribution resources for external distribution. |
| list | List the modules with versions, and if you are working on it. |
| listversions | List all versions in a module's current branch. |
| package | Create a package based on the distribution resources. |
| pickversion | Pick a specific version of a module locally. |
| redeploy | Re-deploy the release. By default this is a placeholder target, the 'buildrelease' or 'main' module can implement this in its 'local.build.xml'. |
| undeploy | Undeploy the release. By default this is a placeholder target, the 'buildrelease' or 'main' module can implement this in its 'local.build.xml'. |
| update | Updates modules to latest status in SCM - this can change the checked out versions! |
| update-ant | Only updates Ant buildfiles in the release, provided the buildtype of the release is 'java'. Handy if you are starting to use a new Antmod release. |
| verbose | When invoked before 'build', this will generate verbose javac output. |
| version | Show the release name and version in this release directory |
Builds all sources, and generates jar, for each module in the release. It does this by executing the module "build" target on each module in the release.
Cleans all build resources, by doing the following:
Cleans all dist related resources, without removing other build results. It does this by:
${antmod.release.dirs.dist} directoryEnables debugging flags for the distribution that will be built; 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
Deploys the release in whatever way it needs to be deployed. Empty target, that invokes 'deployrelease' on the 'buildrelease' module. Allows the 'buildrelease' (or 'main') module to implement this in its 'local.build.xml'.
Example: the following snipped of the 'local.build.xml' of the 'buildrelease' module will deploy to Tomcat:
<target name="deployrelease">
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>
<deploy
url="http://localhost:8080/manager"
username="tomcat"
password="password"
path="/baseurl"
war="file:application.war" />
</target>
Generates distribution contents in the release-level "build/dist/" directory.
By default, the "dist" target does the following:
${antmod.release.dist.dir}/lib/${antmod.jar.prefix}${antmod.release}.jar" with all module jar contents in it, example: "build/dist/lib/petshop-1.1.2.jar".${antmod.release.dirs.dist} directory. The default module buildfile will place all files from the module's "resources/dist" directory there.Conclusion: Javalibs and module build results are placed automatically in the distribution, and each module can contribute more distribution resources by putting those files in the module's "resources/dist" directory.
NOTE: if you need to build a different kind of distribution structure, such as a WAR or an EAR, you can do so by overriding the "distrelease" build target in the 'buildrelease' (or otherwise 'main') module of the release using the "local.build.xml" Ant buildfile. Use the Ant WAR task to build a WAR.
Implementation: the "dist" target invokes the "distrelease" target on the module with type 'buildrelease'/'main'. So the 'buildrelease' module can override this behavior in its "local.build.xml" file.
Lists all modules and the currently checked out version of each module. This is convenient for checking which modules need updating because of a newer version of a module being used in the release descriptor.
Sample output:
RELEASE: petshop-1.2.2 MODULENAME RELEASE VERSION LOCAL VERSION LATEST VERSION TYPE INFO -------------- ---------------- -------------- -------------- ------ -------------- utils 1-6 - 1-6-0 branch - shoppingbasket trunk 1-2-0 n/a tag Update needed scheduler 1-1-0 - n/a tag Read-only petshop 1-2-3 trunk 1-2 trunk Update needed
Lists the available versions in the current branch of a module. This target asks you to enter the name of the module for which the versions need to be listed.
Sample output:
~/dev/petshop-1.1.2 $ ant listversions
Buildfile: build.xml
Antmod:
[input] Please enter a modulename:
shoppingbasket
[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
Packages the contents of the release-level "build/dist/" directory into a ".tar.gz" and a ".zip" file. It takes the output of the dist target as-is, and makes the tarball and zipfile available in the "build/package/" directory of the release.
Implementation: the "package" target invokes "packagerelease" on the module with type 'buildrelease'/'main'. So the 'buildrelease' module can override this behavior in its "local.build.xml" file.
Allows you to change the checked out version of a module, without having to edit the release descriptor and having to do an "ant update" afterwards. This target asks you to enter the name of the module for which a different version needs to be 'picked'.
Sample output:
~/dev/petshop-1.1.2 $ ant pickversion
Buildfile: build.xml
Antmod:
[input] Please enter a modulename:
shoppingbasket
[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.
First undeploys the release and then deploys the release again.
Implementation: the "redeploy" target invokes "redeployrelease" on the module with type 'buildrelease'/'main'. So the 'buildrelease' module can override this behavior in its "local.build.xml" file.
Undeploys the release from an application server or something similar. Empty target, that invokes 'undeployrelease' on the 'buildrelease' module. Allows the 'buildrelease' (or 'main') module to implement this in its 'local.build.xml'.
Example: the following snipped of the 'local.build.xml' of the 'buildrelease' module will undeploy from Tomcat:
<target name="undeployrelease">
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>
<undeploy
url="http://localhost:8080/manager"
username="tomcat"
password="password"
path="/baseurl" />
</target>
Updates the locally checked out files for the release such that the latest updates from CVS/Subversion are available again, and the modules and javalibs have the proper versions as declared in the release descriptor.
Detailed steps performed by the "update" target:
Convenience target for only placing the release and module Ant buildfiles in each module directory and the release directory. This is mostly convenient when you made temporary changes in those files and want to get rid of them without having to do an entire update.
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
Shows the release name and version of the current release directory.
By default, each release directory is named based on the release name and version, example: "petshop-1.1.2/". However, you can rename this directory if you like. In that case this target help you quickly show the release name and version.
Sample output:
~/dev/petshop-1.1.2 $ ant version
Buildfile: build.xml
Antmod:
[echo] Version/Release of this directory is: petshop-1.1.2