ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ringo De Smet <ring...@yahoo.co.uk>
Subject Defining paths AFTER defining properties?
Date Fri, 02 Mar 2001 14:49:01 GMT
Hello,

When I start my build I first check if all the required Jar
files can be found on the build machine. I let Ant fail when
there are missing files.

<target name="init">
  <available property="junit.lib"
     file="${junit}\junit.jar"
     value="${junit}\junit.jar"/>

</target>

<target name="NoJUnit" depends="init" unless="junit.lib">
  <fail message="JUnit not found!"/>
</target>

<target name="compile" depends="NoJUnit">
  ...
</target>

I have a similar setup for other Jar files too. After checking
the required jar files, I would like to define paths that can be
used several times in other tasks, e.g.

<path id="build.classpath">
  <pathelement location="${junit.lib}/>
  <pathelement location="${log4j.lib}/>
</path>

<target name="compile" depends="NoJUnit">
  <javac src="." dest="build">
    <classpathref id="build.classpath">
  </javac>
</target>

However, the properties representing jar files are defined
through available in the init target. Since paths must be
defined outside targets, I can't create paths after init has
run.
I can however define other properties that are the compound of
the value of other properties, but I think paths are nicer. Is
there a solution to my problem? (I hope my explanation is
clear...)

Ringo

=====
Ringo De Smet
Email @ home: Ringo.DeSmet@bigfoot.com
Email @ work: Ringo.DeSmet.atwork@bigfoot.com

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Mime
View raw message