JaVa
   

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 app into AntHill. The first step is to impound the Petstore app 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 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 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 > element.

 <target depends="build">
 <copy file="./META-INF/app.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.


JaVa
   
Comments