ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Chamness" <ma...@cacheware.com>
Subject System Environment variables don't work
Date Tue, 15 May 2001 21:28:41 GMT
Setting the environment parameter for <property>
doesn't work on Windows.

>From the doc:
http://jakarta.apache.org/ant/manual/CoreTasks/property.html
"This functionality is currently only implemented on select platforms."

Ant immediately throws an exception for the following line.

>From my build.xml
---------------------------
 <property environment="env"/>
---------------------------

$ ant
Buildfile: build.xml

BUILD FAILED

C:\project\build\build.xml:22: C:\project\build\build.xml:22:
java.lang.String
IndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
C:\project\build\build.xml:22: java.lang.StringIndexOutOfBoundsException:
String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1503)
        at
org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:
248)
        at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
        at
org.apache.tools.ant.ProjectHelper$TaskHandler.finished(ProjectHelper
.java:482)
        at
org.apache.tools.ant.ProjectHelper$AbstractHandler.endElement(Project
Helper.java:204)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java:1413)
        at com.sun.xml.parser.Parser.content(Parser.java:1499)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:492)
        at com.sun.xml.parser.Parser.parse(Parser.java:284)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
        at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:117)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:403)
        at org.apache.tools.ant.Main.main(Main.java:149)
---------------------------

Setup:
Windows 2000
$ ant -version
Ant version 1.3 compiled on March 2 2001

-mark


===============================================================

List:     ant-user
Subject:  Re: Using System Environment variables
From:     Fabian =?iso-8859-1?Q?M=F6rchen?=
<Fabian.Moerchen@math.uni-giessen.de>
Date:     2001-05-03 16:12:18
[Download message RAW]

hi

haven't tried on win, but this work on linux:

<property environment="env"/>

${env.JAVA_HOME}

bye
fabian


Perry Hunchak wrote:
>
> Is there any way to use the system environment variables (for windows)
> in the build.xml file ant uses?
>
> I currently use specify my tomcat home by pointing to the file system
> path
>
> example:
>   <property name="tomcat.home" value="d:/java/tomcat3.2.1"/>
>
> But I'd like to just use the system environment variable so I could use
> this on different servers
>
> example:
>   <property name="tomcat.home" value="Tomcat_Home"/>
>
> Is there any way to do this?

--
Fabian Mörchen
fabian@mybytes.de
http://www.mybytes.de


Mime
View raw message