Why fAnt?
Best practice
Define your own project layout, for Java, we use the one suggested by Maven2
Examples:
> ant layout # will create src/main/java, src/main/resources etc. directories
Easy to use
Build systems are not easy, they're actually quite complicated, however it should be easy to use, easy to maintain.
Ant is OK, but it doesn't have the convention, it doesn't support the sub modules, it doesn't have dependency management, but it's easy to use, with no major learning curve.
Maven has those features Ant doesn't have, but it's messy, it's not easy to maintain, it's hard to comprehend its usage...
Fant exists to help solve those problems.
It essentially exists as a few additional Ant tasks. All things in Fant are in Ant, which means Ant remains in control. This is in contrast to IVY, which solves the problem similarly, but has additional modules requiring a learning curve to understand. Fant avoids this extra learning block.
Here is an example project definition, basically this is all that is needed to define a project:
<project name="bspell" default="clean" basedir="." xmlns:fant="antlib:com.google.ant.extensions">
<property name="fant.etc.dir" value="${ant.home}/etc/fant"/>
<import file="${fant.etc.dir}/ant-inc/project.xml"/>
<property name="project.group.id" value="com.google.bspell"/>
<property name="project.artifact.id" value="bspell"/>
<property name="project.version" value="0.1"/>
<fant:dependencies id="project.dependencies">
<dependency groupid="suggester" artifactid="suggester" version="1.0.0"/>
</fant:dependencies>
</project>Features
Dependencies
Define the dependencies for your project using the same format as Maven. Fant will leverage the Maven repositories
<fant:dependencies id="project.dependencies">
<dependency groupid="suggester" artifactid="suggester" version="1.0.0"/>
</fant:dependencies>Common Targets
What are known as "phases" in Maven, in Fant we call Common Targets:
compile test coverage install clean spell release deploy undeploy layout --> generate the dir structure follow maven2 conventions format --> jalopy format the source code to meet the code conventions jwhich --> find the jar which contain the $class.name jar war xsd2java wsdl2java finstall --> run install without the checks(pmd, checkstyle) ftest --> run test without the checks(pmd, checkstyle)
Sub Modules
For submodules you need to include a master.xml file. Here is an example:
<import file="${fant.etc.dir}/ant-inc/master.xml"/>
<fant:modules id="project.modules" builddep="true">
<module name="resources" buildfile="build.xml"/>
<module name="api"/>
<module name="core"/>
</fant:modules>The source code download provides an example.
Requirements
Java 1.5 or up Ant 1.7 or up Junit 4.3 or up Checkstyle (Optional) PMD (Optional) bSpell (Optional)
How to Install?
Step1. Checkout the source code
> svn checkout http://fant.googlecode.com/svn/trunk/ fant
Step2. Install Fant
> ant # will install fant to your $ANT_HOME, and copy the pre-defined targets
Step3. Test Go into your sample project, and run
> ant install
Maven Plugins
We have a maven plugin to convert the pom.xml to dependencies.xml, usage:
Step1. Build the maven plugin
> cd maven-plugins > mvn install
Step2. Run Go into your project dir which contains pom.xml, and run
> mvn fant:depc
Then you'll get a dependencies.xml under the current dir
Projects that use Fant
Let us know if your project used fAnt