ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sills, David" <>
Subject RE: How to manage without rules
Date Fri, 12 Oct 2001 17:26:54 GMT
If you are the projects one at a time (even if all sequentially), a simple
solution is to use a property called target, then use ${target} to extract
the value. Then you can simply set target on the command line when calling
ant (-Dtarget=The_Target_Value). I believe the included ant script passes
along such properties, or can easily be modified to do so. You can even set
a default value using the property task in the build file. Once a property
is set it cannot be changed, and requests to do so are ignored, so if it's
set on the command line, the property task is not a danger. (I used to think
that this was terrible, and there was discussion about it on this list, but
have since come to rely on it completely :>)

I use a variant of this method to specify machine-specific properties in my
properties files, using the filtering capabilities of the copy task. I use
${env} to tell me which properties file to use as the source for the
filtering values. Works great, and saves hours of tedious checking. I simply
use different properties files for dev, test, and client values.

Hope this helps.

David Sills

-----Original Message-----
From: WATKINS, Andy, FM []
Sent: Friday, October 12, 2001 12:44 PM
To: ''
Subject: How to manage without rules

In make you have rules, not so in ant

I have a target as follows

  <target name="project1_test" depends="">
    <junit printsummary="no" haltonfailure="yes" fork="yes" timeout="60000">
      <jvmarg value="-Dlog.dir=project1" />

        <path refid="localclasses"/>
        <path refid="classpath"/>

      <formatter usefile="false" type="plain" />

      <batchtest fork="yes">
        <fileset dir="${rbsfm}/project1/classes"
includes="**/*$$Test.class" />
    <echo message="Common tests completed OK" />

The problem is that I have 10 different projects, that all need this
sort of target, but with different directories.

In make, I would have a target called "*.test" and use $@ to pull out the

      Visit our Internet site at

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.

View raw message