Thanks,

 so given a build.xml ...

<project name="Test" default="test" basedir=".">
        <target name="test">
                <property name="param" value="123" />
                <namespace.MyTask/>
                <property name="ParamProp" refid="${param}.prop"/>
                <echo message="ParamProp = ${ParamProp}"/>
        </target>
</project>

And  the java code for the task ...

package namespace;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

public class MyTask extends Task
{
        

        @Override
        public void execute() throws BuildException
        {
                getProject().addReference("123.prop", "franjipan");
        }
        
}

I get "franipan" echo'd...



----------------------------------------------------------------------------
--------------

This message is private and confidential. If you have received this message
in error, please notify postmas...@his.co.uk and remove it from your system.

Please carry out your own virus check before opening attachments.

HISL Limited is a limited company registered in England and Wales.

Registered Number: 3202995. VAT number: 729-6256-05.

Registered Office: Chestnut Farm, Jill Lane, Sambourne, Redditch B96 6ES

----------------------------------------------------------------------------
--------------


-----Original Message-----
From: Stefan Bodewig [mailto:bode...@apache.org] 
Sent: 12 May 2009 16:52
To: user@ant.apache.org
Subject: Re: API for setting a property reference?

On 2009-05-12, John Francis <jfran...@his.co.uk> wrote:


>     Is there a way to programmatically (i.e. using the API) set the id 
> of a property in Ant, so I can reference it via refid later on?

Project#addReference is what you are looking for.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional
commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to