Using AntHill with Petstore


Now that we have a good idea of how to use AntHill for a project, let's look at how to put our Petstore application into AntHill. The first step is to impound the Petstore application in the repository. Before

actually impounding the code, add a text file to the root directory of your Petstore code called version, and set the version within to 0.5.0 or some other text. Change to the root directory of the Petstore code and issue a command like the following:

 cvs d ~/repository import m  petstore petstore initial 

As you might expect, we are going to have to do a little surgery on the build.xml file to make sure the artifacts for the Petstore are placed in the right directory once it is built. The first step in the process is to include the following <property> tags in the build.xml file:

 <property name="deployDir" location="dist"/> <property name="dist.dir" location="${deployDir}"/> 

There are two different places where the deployDir needs to be used. The first is within the <target name=" "> element. The code is:

 <target name="prepare" depends="init"                           description="prepare the output directory.">         <mkdir dir="${lib}" />         <mkdir dir="${dist}" />         <mkdir dir="${deployDir}" />     </target> 

Simply change the ${deploy} variable to ${deployDir}. The same thing needs to be done in the <target name="package"> element.

 <target name="package" depends="build">         <copy file="./META-INF/application.xml" todir="${dist}/META-INF" />         <jar jarfile="${deployDir}/pet.jar"              basedir="${dist}" />     </target> 

Once the build.xml file has been changed, commit the changed file to the source code repository.

Creating a Project

With the code committed to the repository and the build file changed, it's time to create an appropriate project. The changes necessary are as follows :

  1. Set anthill.project.name to an identifier such as Petstore.

  2. Configure anthill.repository.adapter for the username and project under which the Petstore code was impounded.

  3. Set anthill.build.script to build.xml.

  4. Set the e-mail address as needed and any of the other optional parameters, and update the project. If successful, the project will appear in your Project list.

Doing a Build

Now it's time to check to see if things worked out. Click the Build link for the Petstore project. Be sure to enable the Force Build checkbox. After some time, you should see a successful build. If not, check the buildLogs and make any appropriate changes. Again, most problems with the build will be related to the source code repository if the build.xml script works outside the AntHill system.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net