Plugins

The Antmod build engine is extensible with build plugins. These plugins are all Ant-based, and allow plugging in of various build features, like building WARs, EARs, documentation, generating hibernate mappings, etcetera...

Available Plugins

  • Cobertura Plugin: Test coverage plugin, using Cobertura (based on jcoverage).
  • FindBugs Plugin: Static code analysis plugin, using FindBugs.
  • Hibernate Plugin: O/R mapping plugin; generates Hibernate mappings and exports DB schema.
  • Jar Plugin: Creates jar files using the Ant jar task.
  • Javac Plugin: Compiles Java code using the Ant javac task.
  • Javadoc Plugin: Produces Javadoc API documentation using the Ant javadoc task.
  • JUnit Plugin: Unit test plugin; runs junit test cases and generates test report.
  • OSGi Plugin: Allows for creation of OSGi bundles during a build.
  • Tomcat Plugin: Uploads all created webapps to an Apache Tomcat servlet container.
  • War Plugin: Generates a web application archive (WAR) for one or more modules in a release.
  • XDoc Plugin: Converts xdocs into HTML using Velocity's Anakia.

Build targets

When a release is checked out, Antmod will automatically register the plugin's build targets to the release and module buildfile. So using a plugin is as simple as:

  • Checking out the release with Antmod
  • Change directory to the release or module, for example "cd /home/klaas/dev/myrelease-dev"
  • Use a documented plugin build target for the release or module, for example "ant junit"
  • If you want to check which build targets are available, execute: "ant -p"

NOTE: if an Ant target is missing, while you know that it has to be there, you may be working with an old checkout of a release which does not have the build plugin registered yet in the buildfiles. Solve this by changing directory to the release (for example "cd /home/klaas/dev/myrelease-dev") and running "ant update-ant".

Plugin properties

Every plugin has a set of documented properties that can be configured to customize the behavior of the plugin. For example, the JUnit plugin allows you to specify whether an HTML report is a frames or non-frames version using its ${antmod.junit.report.format} property.

Configuring a plugin is as simple as setting one of the documented plugin properties to the desired value. There are various ways to configure this:

  • Configure per release: Add the plugin property value to the section of the release descriptor. This is what is usually the best way to configure a plugin, as it allows for customized plugin behavior per specific project. For example:

  • antmod.junit.report.format=noframes

  • Configure per repository: You can configure a plugin for all developers using a repository, by setting the property in an "antmod-conf" module in the repository. For example:
    • In the "trunk" of the module "antmod-conf", create a properties file, let's say "pluginconfig.properties"
    • In the file "pluginconfig.properties" add the configuration such as:
    •  # disable frames in JUnit HTML reports
      antmod.junit.report.format=noframes
    • Make sure to add/commit your changes to "pluginconfig.properties" to the repository
    • NOTE: this config is picked up by Antmod once an hour from the repository, so it can take a little while before other developers get your configuration change

  • Configure per user: Simple add the plugin property value to your "${HOME}/.antmodrc" file.

Adding/installing new plugins

If you have downloaded/obtained an Antmod plugin, you can add it to your Antmod installation by following these steps:

  1. Store plugin archive, for example "newplugin.jar", on your harddisk
  2. Unpack "newplugin.jar" in your "${ANTMOD_HOME}/plugins" directory, for example: "jar -xf /home/klaas/newplugin.jar"
  3. You should now have a "${ANTMOD_HOME}/plugins/newplugin" directory
  4. Antmod will automatically pick up the new plugin from your "${ANTMOD_HOME}/plugins" directory