Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
How do I get at the project base dir inside a subclass of BaseExtendSelector?

How do I get at the project base dir inside a subclass of BaseExtendSelector?

2003-03-31       - By Tim Gordon

Hi

I'm passing <param name="somedir" value="${some.relative.directory}">
parameter into a custom selector, which is a subclass of BaseExtendSelector.
${some.relative.directory} is defined relative to the project ${basedir}, so
inside my code I'll get a string value for the "somedir" parameter which is
basically useless to me unless I can do

new File(project.getBasedir(), somedir);

However, setProject() never seems to get called on my custom selector, even
though it's a ProjectComponent. Is this a bug in ANT BaseExtendSelector or
AbstractFileSet, not setting the project on the component?

I can acheive the effect I'm after by passing in <param name="somedir"
value="${basedir}/${some.relative.directory}"> - do I have to live with
that? I'd rather pass in paths defined relative to the project basedir,
which is consistent with passing around directories in the rest of ANT.

Tim Gordon

Allustra Limited
1 Royal Exchange Avenue
London
EC3V 3LT
Tel 020 7464 4190
Tel 020 7464 4194
http://www.allustra.com/



©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.