You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Kantor, H Steve Jr CIV NSWC PC" <ha...@navy.mil> on 2009/11/18 00:27:19 UTC

Feature Request - import task use environment variable

All,

I would like to have the import task use an environment variable (ANT_IMPORT_PATH) when importing files.  Is there any interest in this?  I've already implemented and can provide a patch for testing.

Thanks,
Harry

Re: Feature Request - import task use environment variable

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-11-19, Kantor, H Steve Jr CIV NSWC PC <ha...@navy.mil> wrote:

> The idea of the ANT_IMPORT_PATH is to provide a list of possible
> locations to import a file from.  Our shop places software either in
> $HOME/local (if you're compiling from source and do an "ant install"),
> $HOME/rpm (if you've installed from an rpm), or / (if installed as
> root).  This setup would allow me to set ANT_IMPORT_PATH to
> "$HOME/local:$HOME/rpm:/" and include the file with a simple import
> statement.

I see.

Another approach could be to add ANT_IMPORT_PATH to CLASSPATH and use a
<javaresource> to import it, this would work without any changes to
Ant trunk.

Ant isn't using environment variables anywhere outside of the wrapper
scripts and I'd be reluctant to using them - in particular given Java's
history of supporting or not supporting environment variables at all,
just look at the code Ant uses to read the environment on different
platforms.

Since you have opened a bugzilla issue for this - thanks! - people are
free to try it out and voice their opinion.  I for one am not convinced
this would belong in Ant's core, but wouldn't stand in the way if
another committer wanted to apply your patch.

Cheers

        Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


RE: Feature Request - import task use environment variable

Posted by "Kantor, H Steve Jr CIV NSWC PC" <ha...@navy.mil>.
The idea of the ANT_IMPORT_PATH is to provide a list of possible locations to import a file from.  Our shop places software either in $HOME/local (if you're compiling from source and do an "ant install"), $HOME/rpm (if you've installed from an rpm), or / (if installed as root).  This setup would allow me to set ANT_IMPORT_PATH to "$HOME/local:$HOME/rpm:/" and include the file with a simple import statement.  I'm looking to place the search paths in a variable (similar to CPLUS_INCLUDE_PATH for g++ compiler) and have the import task use the first found file.

If I use the current implementation, I'd have to add a number of path elements to the build.xml file.  I prefer to keep the build.xml file as small and clean as possible, so I'd prefer not to do this. 

Re: Feature Request - import task use environment variable

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-11-18, Kantor, H Steve Jr CIV NSWC PC <ha...@navy.mil> wrote:

> I would like to have the import task use an environment variable
> (ANT_IMPORT_PATH) when importing files.

Can't this already be done?

<property environment="env"/>
<import file="${env.ANT_IMPORT_PATH}"/>

> Is there any interest in this?

Right now I don't see the general use, but maybe I'm overlooking
something.  In what way would the change improve the current
implementation that would be difficult/cumbersome to do right now?

Please note that in svn's trunk <import> supports importing resource
collections and thus opens up a whole lot of new possibilities.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org