Ant problem with property substitutions.

R

RJGraham

Hello,

I have a few properties defined in my ant build file, but substitutions are
not occurring on all tasks.

For example, in the snippet below, my jar file gets named correctly with the
build number property value added to my jar file name, e.g. 'camlet1.jar'
for build.number = 1.
The mkdir task also creates the proper directory (ie., 'dist' directory is
created).

But, the copy task creates a directory named '$deploy' instead of 'dist' as
expected.
The two replace tasks also insert '$(build.nember)' instead of the build
number value.

What am I doing wrong?
I assume property substitutions should work with copy and replace.

Thanks for any help.

-Randy


<property name="build" location="build/"/>

<property name="dist" location="dist/"/>

<property name="deploy" location="dist/"/>

<target name="dist" depends="compile"

description="generate the distribution" >

<!-- Create the distribution directory -->

<mkdir dir="${dist}"/>

<jar jarfile="${dist}/camlet${build.number}.jar" basedir="${build}"

manifest="deployed/MANIFEST.MF"/>

<copy todir="$(deploy)/">

<fileset dir="deployed">

<exclude name="MANIFEST.MF"/>

</fileset>

</copy>

<replace file="$(deploy)/camlet.html" token="camlet.jad"
value="camlet$(build.number).jad"/>

<replace file="$(deploy)/camlet.jad" token="camlet.jar"
value="camlet$(build.number).jar"/>

</target>
 
T

Tony Morris

$(deploy)

is not the same as

${deploy}

Depending on what font you use, that should be obvious.
If it isn't, open this message in a hex editor.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
R

RJGraham

Thanks, but I don't understand....

-Randy

Tony Morris said:
$(deploy)

is not the same as

${deploy}

Depending on what font you use, that should be obvious.
If it isn't, open this message in a hex editor.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
T

Tony Morris

Try this:

class X
{
public static void main(String[] args)
{
System.out.println('(' == '{');
System.out.println(')' == '}');
}
}

If you copy/paste it correctly and run it, you should see:
false
false

I don't know how else to explain it.
"$(deploy)".equals("${deploy}")
will return false.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
S

Sudsy

RJGraham said:
Thanks, but I don't understand....

-Randy

Tony gave you exactly the information you require, namely that
you are apparently trying to use regular brackets () instead of
the curly braces {} required.
Instead of
$(build.nember)
(sic), you should be usiung
${build.nember}
But if build.nember should actually be build.member then you've
already located your mistake...
 
R

RJGraham

Thanks,

That'll learn me for using tiny fonts with eclipse ;)
(and my mail reader).

-Randy


Tony Morris said:
Try this:

class X
{
public static void main(String[] args)
{
System.out.println('(' == '{');
System.out.println(')' == '}');
}
}

If you copy/paste it correctly and run it, you should see:
false
false

I don't know how else to explain it.
"$(deploy)".equals("${deploy}")
will return false.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform


Thanks, but I don't understand....

-Randy

directory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top