• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting root path with Ant (on Windows)

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey folks.

My webapp-CM is (of course) done with Ant. How is it possible to signify in the copy-task that i am pointing to an absolute path (C:/xx/..../webapps).

e.g. <copy file"foo" todir="${tomcat.dir.defined.in.build.properties}"/>

I tried a slash-prefix in todir="/${xxxx}" to get to root. Unfortunately on Windows Ant is putting always a C: to it, so todir is always fixed to current partition of harddisk. But my aim is to externalize the tomcat directory completely to my build.properties.

Can that be done?

thank u!
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did not understanf wat u exactly wanna do... if its just the absolute path u need to mention, then the property should be assigned the absolute path of the folder where you want to copy.
Otherwise can you re-explain yuor problem?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
manuel and Pratik, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
JavaRanch Sheriff
 
manuel aldana
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I set
absolute.path=C:/xxx/webapps

and put it to <copy todir="${absolute.path}" .../>,
Ant prepends ${basedir} to it, which is defined in <project>-tag.
I would like that 'todir' ignores 'basedir' and just takes 'absolute.path' as path.

writing todir="/${absolute.path}" does not work, because Ant on Windows still prepends C: to 'absolute.path'.

thanks.

[ March 06, 2006: Message edited by: manuel aldana ]
[ March 06, 2006: Message edited by: manuel aldana ]
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An absolute path has to include the drive ID. Else how how the apps know which of the 26 possible drives to search? Windows isn't like Unix where there's a single filesystem root.

However, I think this is what you're looking for:

C:> SET TOMCAT_HOME=C:\JAKARTA\TOMCAT-5.0.30

For best results, set this in your Windows Control panel system environment, using whatever directory path locates the version of Tomcat you want to reference.

In your build.xml:



Now you can reference tomcat.home as needed. For example:

<property name="servlet.api.jar" value="${tomcat.home}/common/lib/servlet-api.jar"/>
 
manuel aldana
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you (though i knew this already

i found my stupid error. i was using backslash \ as path seperator in my build.properties.

aaaargh...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic