Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
property set in sub-task not defined

property set in sub-task not defined

2003-03-17       - By Dominique Devienne
Reply:     1     2     3     4     5     6     7     8  

I think you are mistaken, as the following proves:

P:\org_apache\antx>%ANT_HOME%/bin/ant -f lib-classpath.xml
-Dlib.dir=Z:\dev\null
Buildfile: lib-classpath.xml

-lib.dir.exists?:

-set.lib.classpath:

test:
    [echo] lib.classpath =

BUILD SUCCESSFUL
Total time: 1 second
P:\org_apache\antx>%ANT_HOME%/bin/ant -f lib-classpath.xml
-Dlib.dir=%JAVA_HOME%\jre\lib
Buildfile: lib-classpath.xml

-lib.dir.exists?:

-set.lib.classpath:

test:
    [echo] lib.classpath =
C:\pro\jdk1.4.0_01\jre\lib\ext\dnsns.jar;C:\pro\jdk1.4.0_01\jre\lib\ext\
jmxri.jar;C:\pro\jdk1.4.0_01\jre\lib\ext\ldapsec.jar;C:\pro\jdk1.4.0_01\jre\
lib\ext\localedata.jar;C
:\pro\jdk1.4.0_01\jre\lib\ext\sunjce_provider.jar;C:\pro\jdk1.4.0_01\jre\lib
\security\local_policy.j
ar;C:\pro\jdk1.4.0_01\jre\lib\security\US_export_policy.jar

BUILD SUCCESSFUL
Total time: 1 second
P:\org_apache\antx>type lib-classpath.xml
<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
    Dominique Devienne <ddevienne@(protected)>         Mar 2003
 -->
<project name="antx" default="test">

 <target name="test" depends="-lib.dir.exists?, -set.lib.classpath">
   <property name="lib.classpath" value="" />
   <echo>lib.classpath = ${lib.classpath}</echo>
 </target>

 <target name="-lib.dir.exists?">
    <available file="${lib.dir}" type="dir"
               property="lib.dir.exists" />
 </target>

 <target name="-set.lib.classpath" if="lib.dir.exists" >
   <path id="lib.classpath">
     <fileset dir="${lib.dir}" includes="*/*.jar" />
   </path>
   <property name="lib.classpath" refid="lib.classpath" />
 </target>

</project>

P:\org_apache\antx>

Regards, --DD

-----Original Message-----
From: Pedro Salazar [mailto:pedro-b-salazar@(protected)]
Sent: Monday, March 17, 2003 3:24 PM
To: Ant Users List
Subject: RE: property set in sub-task not defined

Hi Dominique,

your sample does not work!
The output if you "echo" the "${lib.classpath}" is "${lib.classpath}",
and not is value...

Should I test it OK?

thanks,
Pedro Salazar.

On Mon, 2003-03-17 at 20:46, Dominique Devienne wrote:
> Using pure Ant:
>
> <target name="init" depends="-lib.dir.exists?, -set.lib.classpath">
>   <property name="lib.classpath" value="" />
>   ...
> </target>
>
> <target name="-lib.dir.exists?">
>    <available file="${lib.dir}" type="dir"
>               property="lib.dir.exists" />
> </target>
>
> <target name="-set.lib.classpath" if="lib.dir.exists" >
>   <path id="lib.classpath">
>     <fileset dir="${lib.dir}" includes="**/*.jar" />
>   </path>
>   <property name="lib.classpath" refid="lib.classpath" />
> </target>
>
> Using Ant-contrib would be nicer of course. Maybe one day it will make it
to
> Ant: some committer seem to prefer spaghetti Ant as above than an <if>,
but
> maybe just maybe the wind is turning from recent posts on ant-dev... --DD
>

--
<id name="pedro salazar">
<email>pedro-b-salazar@(protected)</email>
<pgp-key-id>0E129E31D803BC61</pgp-key-id>
</id>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.