ant build.xml windows white space in path
Asked Answered
I

6

15

I'm using Windows and I'm trying to get ANT to work.

When I do an ant build from the command line, I get: C:\dev\Projects\springapp\${%ANT_HOME%}\lib not found.

I look into the build.xml file and I find: appserver.home=${user.home}/apache-tomcat-6.0.14 (which I just copied and pasted straight from a tutorial)

I changed it to:

appserver.home="C:\Program Files\Apache Software Foundation\Tomcat 6.0"

but now I get:

C:\dev\Projects\springapp\"C:Program FilesApache Software FoundationTomcat 6.0"\lib not found.

It seems like the white space in Program Files and Tomcat 6.0 are causing the build to fail. How do you deal with these in xml files without re-creating the directory with a path with no white space?

Invoke answered 10/9, 2008 at 21:45 Comment(0)
L
13

Change it to

appserver.home="C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0"
Leprous answered 10/9, 2008 at 22:20 Comment(2)
Or use '/' instead of '\\'. It works the same in Ant on Windows and is a little easier to read.Historic
do you even need the quotes? I think this should work: appserver.home=C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0Actinoid
L
6

Variant with "/" instead "\" works on my system. Just need to delete " symbols before and after path structure.

Lattie answered 8/9, 2010 at 12:49 Comment(0)
T
3

Find the Windows short name for those directories using dir /x and use thme when setting path values.

Some more discussion at How does Windows determine/handle the DOS short name of any given file?

Tormentor answered 26/7, 2011 at 13:21 Comment(0)
N
2

It looks like you have your properties setup incorrectly.

I'm guessing your basedir property is pointing at C:\dev\Projects\springapp and your properties are using value like:

<property name="property.1" value="directory" />

instead of

<property name="property.1" location="directory" />

Using the location property then resolves links as relative to your basedir if the location is a relative path and to the absolute path if you enter one of those. If you could post parts of your Ant file specifically how you define appserver.home and how you use it in the task that's throwing the error I could be more specific.

Niles answered 11/9, 2008 at 15:36 Comment(0)
C
1

In addition to escaping the windows directory separator also make sure that all paths that you type in should be with correct capitalisation, Windows is not case sensitive but case presrving, while Ant is case sensitive.

Cockle answered 10/9, 2008 at 23:32 Comment(0)
F
1

In the top of your build.xml, try adding <property environment="env"/> and then using ${env.USER_HOME} (or whatever you have in your environment). That did it for me (${env.JAVA_HOME} rather than ${java.home}).

Feat answered 1/12, 2010 at 18:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.