You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Victor Bucutea <vi...@softspot.ro> on 2009/01/11 09:46:47 UTC
set Path element id
Hi ,
I'm developing a custom Task in which i wish to dynamically create a <path>
. My code is :
public void execute() throws BuildException {
if (stringElemente == null || separator == null ) {
throw new BuildException(
"Nu ai completat toti parametrii :
stringElemente , separator ");
}
StringTokenizer st = new StringTokenizer(stringElemente,
separator);
Path dynamicClassPath = new Path(getProject());
while (st.hasMoreTokens()) {
String token = st.nextToken();
// Creem un nou path pentru fiecare token si il adaugam la
classPath
log("Adding to classpath resource: "+token);
PathElement path = dynamicClassPath.createPathElement();
path.setLocation(new File(token));
}
//dynamicClassPath.setRefid(new
Reference(getProject(),"dynamic.classpath"));
}
I'm trying to dynamically create a classpath (e.g. Path element ) for later
use.
The problem is that I cannot set an id ( same as <path
id="compile.classpath"/> ) , which i will later use to reference that path !
Thanks,
Victor BucuĹŁea
Programmer
RE: set Path element id
Posted by Victor Bucutea <vi...@softspot.ro>.
OK,
But how do I set an id which i could later use for referencing that Path ?
Thanks,
Victor
-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Monday, January 12, 2009 8:02 AM
To: user@ant.apache.org
Subject: AW: set Path element id
> Path dynamicClassPath = new Path(getProject());
> //dynamicClassPath.setRefid(new
Reference(getProject(),"dynamic.classpath"));
>
>The problem is that I cannot set an id ( same as <path
>id="compile.classpath"/> ) , which i will later use to
>reference that path !
Your (commented) code tries to set the REFID not the ID attribute.
Every datatype can have an ID attribute.
If you want to specify a REFID you cannot specify the 'content' because
you want to refer another datatype.
Jan
---------------------------------------------------------------------
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
AW: set Path element id
Posted by Ja...@rzf.fin-nrw.de.
> Path dynamicClassPath = new Path(getProject());
> //dynamicClassPath.setRefid(new
Reference(getProject(),"dynamic.classpath"));
>
>The problem is that I cannot set an id ( same as <path
>id="compile.classpath"/> ) , which i will later use to
>reference that path !
Your (commented) code tries to set the REFID not the ID attribute.
Every datatype can have an ID attribute.
If you want to specify a REFID you cannot specify the 'content' because
you want to refer another datatype.
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org