ANT’s best practices - VI

12 May 2008

It is always a good idea to keep the build process self-contained. This post is all about this.

Try your best not to refer to external paths and libraries. Also don’t depend on the programmer’s CLASSPATH setting. Use relative paths throughout the build file and define your own paths. This will make your build file independent and portable. It’s a bad idea to refer to an explicit path such as C:\java\tools because then the other developers will have to follow the same directory structure in order to execute the build file.
If you are deploying an open source project, provide a distribution that includes all JAR files necessary to compile the code. And for internal projects, dependent JAR files should be managed under version control and checked out to a well-known location.

You may define path as properties when you do have to refer to external paths. In this way, the programmers can override those settings to conform to their own machines. Refer to environment variables is done as follows:

<property environment="env"/>
<property name="dir.jboss" value="${env.JBOSS_HOME}"/>

del.icio.us:ANT's best practices - VI  digg:ANT's best practices - VI  spurl:ANT's best practices - VI  wists:ANT's best practices - VI  simpy:ANT's best practices - VI  newsvine:ANT's best practices - VI  blinklist:ANT's best practices - VI  furl:ANT's best practices - VI  reddit:ANT's best practices - VI  fark:ANT's best practices - VI  blogmarks:ANT's best practices - VI  Y!:ANT's best practices - VI  smarking:ANT's best practices - VI  magnolia:ANT's best practices - VI  segnalo:ANT's best practices - VI  gifttagging:ANT's best practices - VI

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: ANT's best practices - VI

Leave a Reply