What happens if you run the build outside of Eclipse? -- Jonathan Rosenberg Founder & Executive Director, Tabby's Place http://www.tabbysplace.org/
-----Original Message----- From: Bailey, Darragh [mailto:dbai...@hp.com] Sent: Friday, July 23, 2010 9:51 AM To: Ant Users List Subject: Problem with Ant pathconvert and paths with spaces I've been trying to run my ant builds within eclipse and I've been running into a slight problem with the path generated by the pathconvert task. After some testing, it seems that it's a problem in general with spaces appear in paths. The project that I have needs to pick up a library from another project in my tree, until such time that I have everything converted to publish and retrive artifacts from ivy, I've been using whichresource & pathconvert to assist in locating the library from another project in my tree. Here's a snippet of the ant tasks I'm using: <whichresource property="extra.lib.url" class="${extralib.classname}"> <classpath> <fileset dir="${extra.lib.dir}" > <include name="**/*.jar" /> </fileset> </classpath> </whichresource> <fail unless="extra.lib.url" message="Extra library required not found" /> <pathconvert property="extra.lib"> <path location="${extra.lib.url}" /> <regexpmapper to="\1" from="file:([^\!]*)" /> </pathconvert> <echo message="Using extra lib from ${extra.lib}" /> <path id="classpath.extra.lib.id"> <fileset file="${extra.lib}" /> </path> I reference classpath.extra.lib.id in the classpath that I construct for the javac task. When running the Ant build on linux, I normally don't have spaces in the directory names, so everything worked fine until I tried to enable Ant builds within eclipse. My workspace directory resides under "C:\Documents and Settings\<my username>\My Documents\workspace". So when I build I get the following error: "C:\Documents and Settings\<my username>\My Documents\workspace\<some project>\build.xml:201: C:\Documents%20and%20Settings\<my username>\My%20Documents\workspace\extralib\build not found." Some testing on the linux, by moving extralib to extralib\ test and setting the property extra.lib.dir on the command line as following, resulted in a similar error message: -Dextra.lib.dir=/build/extralib\ test/trunk "/build/<some project>/trunk/build.xml:209: /build/extralib%20test/trunk/build does not exist." The echo line in the ant code above prints the following output: "Using common lib from /build/extralib%20test/trunk/build/extralib-0.1.0.jar" So I know that the whichresource part is locating the file, and the pathconvert is striping the "jar:file:" from the start and the "!${extralib.classname}" text from the end. The problems seems to be due to the space getting converted to "%20" by whichresource, and I don't seem to be able to match it to change it back. Besides changing the workspace directory to c:\workspace\ and asking all the other developers that are working on the project to do the same, is there anything I can do to change how I'm using pathconvert to avoid this problem? Searching the mail archives it seems someone else ran into the same issue back in Feb 2008: http://mail-archives.apache.org/mod_mbox/ant-user/200802.mbox/%3C003001c86d2 7$3ef33ee0$0a01a...@workstation%3e But the only solution suggested was to effectively require the property being set, to be set to the exact path required in the first place and thus not use whichresource at all. Is that the only alternative? (besides writing an extension) -- Regards, Darragh Bailey Systems Software Engineer Hewlett Packard Galway Ltd. Postal Address: Hewlett Packard Galway Limited, Ballybrit Business Park, Galway Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerson's Quay Dublin 2 Registered Number: 361933 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org