ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: RE : Has anyone written an ant task by extending Task
Date Thu, 25 Sep 2003 07:15:39 GMT
Do you know the tutorial of writing tasks?

on WIKI
http://nagoya.apache.org/wiki/apachewiki.cgi?AntTutorialWritingTasks

on Bugzilla
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22570

with 1.6 (not released yet) in the manual
/docs/manual/tutorial-writing-tasks.html

in CVS
http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/docs/manual/tutorial-writin
g-tasks.html?rev=HEAD&content-type=text/plain



Jan



> -----Original Message-----
> From: Emmanuel FELLER [mailto:Emmanuel.FELLER@maaf.fr]
> Sent: Wednesday, September 24, 2003 2:36 PM
> To: 'Ant Users List'
> Subject: RE : Has anyone written an ant task by extending Task
> 
> 
> Hello,
> 
> You have to override the execute() method.
> 
> Hope it helps,
> Emmanuel
> 
> >-----Message d'origine-----
> >De : Malik, Yousuff M [mailto:Yousuff.M.Malik@erac.com] 
> >Envoyé : mardi 23 septembre 2003 23:59
> >À : Ant Users List
> >Objet : Has anyone written an ant task by extending Task
> >
> >
> >
> >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: user-unsubscribe@ant.apache.org
> >For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message