how to update the ant properties in runtime from java class files

85 Views Asked by At

I have different java classes which i am triggering using taskdef action. My problem is i have to pass the properties from foo.properties as an input to the java class that is triggered by taskdef actions.

Within the java classes i wanted make the changes to these properties. The changed properties should be reflected globally for all java classes that are invoked by different taskdef actions and the properties lifetime should be available till the completion of the all the ant tasks. Below mentioned code is the sample code which i am using.

<?xml version="1.0" encoding="ISO-8859-1"?>
<property file="foo.properties"/>
<project name="MyTask" basedir="." default="use">
        <taskdef name="helloworld" classname="HelloWorld" classpath="${ant.project.name}.jar"/>
        <helloworld/>
<taskdef name="helloworld1" classname="HelloWorld1" classpath="${ant.project.name}.jar"/>
        <helloworld1/>
<taskdef name="helloworld2" classname="HelloWorld2" classpath="${ant.project.name}.jar"/>
        <helloworld2/>
</project>

Please Help me with necessary suggestions.

0

There are 0 best solutions below