You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ringo De Smet <ri...@yahoo.co.uk> on 2001/03/02 15:49:01 UTC

Defining paths AFTER defining properties?

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