I am trying to write a custom ant task by extending Task. My task needs to read a string, parse it and save the value in a property.
I have completed the reading string and the parsing part. I don't know how to set the value in a property. Can anyone please help me with this This is my Class package com.erac.arch.prod.statusweb; import org.apache.tools.ant.taskdefs.Property; import org.apache.tools.ant.Task; import org.apache.tools.ant.BuildException; public class BuildLabelParser extends Task{ protected String value; protected String name; public void setValue(String value){ //Strip out the build number from the ant label BUILD_LABEL String temp2 = value.substring(value.indexOf("_")+1); //Convert it into the format x.x.x.x from x.x.x_x value = temp2.substring(0,temp2.indexOf("_"))+"."+ temp2.substring(temp2.indexOf("_")+1); //this.setName(this.value); System.out.println("Value is " + value); } public String getValue() { return value; } public void setName(String name) { this.name = name; } public String getName() { return name; } public String toString() { return value == null ? "" : value; } This is how I invoke it in the ant script <target name="test.parser"> <taskdef name="buildlabelparser" classname="com.erac.arch.prod.statusweb.BuildLabelParser"> <classpath> <pathelement location="${libDir}/anttasks.jar"/> </classpath> </taskdef> <buildlabelparser name="xyz" value="LRDGUI_2.0.2_3"/> </target> The output after I execute the target U:\arch_vob\Products\lrdGUI\antbuild>ant test.parser Buildfile: build.xml test.parser: [buildlabelparser] Value is 2.0.2.3 [echo] LRDGUI_2.0.2_3 Any help would be appreciated? Regards Yousuff Malik ERAC --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]