1 / 19

Jakarta Ant

Jakarta Ant. Sean C. Sullivan June 25, 2002 Portland Java Users Group. Jakarta. Tomcat Struts Ant Log4j HttpClient …and many more!. What is Ant?. Ant is an extensible build tool. “In theory, it is kind of like Make, but without Make's wrinkles.”. Projects that use Ant. Tomcat

sandra_john
Download Presentation

Jakarta Ant

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jakarta Ant Sean C. Sullivan June 25, 2002 Portland Java Users Group

  2. Jakarta • Tomcat • Struts • Ant • Log4j • HttpClient • …and many more!

  3. What is Ant? Ant is an extensible build tool. “In theory, it is kind of like Make, but without Make's wrinkles.”

  4. Projects that use Ant • Tomcat • NetBeans • JBoss • JDOM

  5. What Ant Can Do For You • automate your project’s build and deployment tasks • compile Java source code • create JAR’s, ZIP’s, EAR’s, and WAR’s • automate Javadoc generation • run test suites • deploy files to remote systems

  6. Ant terminology • buildfile • project • targets • tasks

  7. Example build file: build.xml <project name="FooEJBProject" default="build" basedir="."> <property name="jboss-rootdir" value="c:/jboss-3.0.0/" /> <property name="j2ee-jarfile" value="${jboss-rootdir}/server/all/lib/jboss-j2ee.jar" /> <property name="fooejb-jarfilename" value="FooEJB.jar" /> <target name="all" depends="init, build, dist"/> <target name="init"> <mkdir dir="${outputdir}" /> </target>

  8. build.xml (continued) <target name="clean"> <delete dir="${outputdir}" /> </target> <target name="dist" depends="init, EJBJarFile"/>

  9. build.xml (continued) <target name="EJBJarFile" depends="init, build"> <ejbjar srcdir="${classesdir}" destdir="${outputdir}" descriptordir="${basedir}" basejarname="${fooejb-jarfilename}" genericjarsuffix="" classpath="${classesdir};${j2ee-jarfile}" > <include name="**/ejb-jar.xml"/> <support dir="${classesdir}"> <include name="*.class" /> </support> </ejbjar> </target>

  10. build.xml (continued) <target name="build" depends="init"> <javac srcdir="${javasrcdir}" deprecation="on" destdir="${classesdir}" includeAntRuntime="no" classpath="${j2ee-jarfile}" debug="on" /> </target> </project>

  11. Common tasks • <property> • <javac> • <jar> • <ejb-jar> • <javadoc> • <junit> • <touch> • <copy> • <delete> • <move> • <fileset> • <cvs> • <exec> • <mail>

  12. Creating your own Ant task public class MyTask extends org.apache.tools.ant.Task { public void execute() { … } public String getFoo() { … } public String setFoo() { … } }

  13. Monitoring a build • create a “build listener” class • implement Ant’s BuildListener interface

  14. Ant related tools… • CruiseControl • Centipede • AntHill • Maven

  15. CruiseControl • a “tool for setting up a continuous build process” • http://cruisecontrol.sourceforge.net/ • a set of tasks to automate the checkout/build/test cycle • a servlet for viewing the status of the current build as well as the results of previous builds

  16. Centipede • project build system • http://www.krysalis.org/centipede/ • Defines format for: • code modules • project status information • project layout • Features: • Java source colorizer • UML doclet

  17. AntHill http:/www.urbancode.com/projects/anthill/default.jsp • ensures a controlled build process • performs a checkout from the source repository of the latest version of a project before every build and tags the repository with a unique build number after every build • automatically updates a project intranet site with artifacts from the latest build

  18. Maven • is a “project management and project comprehension tool” • http://jakarta.apache.org/turbine/maven/ • well-defined Project Object Model • useful when you need to build multiple projects

  19. Summary • Ant is easy to use and powerful • download Ant at http://jakarta.apache.org/ant/

More Related