jQuery in Action, 3rd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant - Directory not created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant - Directory not created" Watch "Ant - Directory not created" New topic
Author

Ant - Directory not created

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Hi guys! I'm just wondering why the setup-war-structure target particularly the line

<mkdir dir="${wardir}"/>

doesn't seem to execute. I can't see a directory named war in my basedir. Everything else though are created.




Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17146
    
  27

Try using a forward slash instead of a backslash in the directory pathname. That is: "${basedir}/war".

Forward slashes work almost every place backslashes do for filename paths in Java (and Ant is a Java program). However they carry 2 advantages:

1. They work when running the ant builds on non-Windows systems like Solaris.

2. Forward slashes don't have a "magic" meaning. Backslashes are used in Java for escape sequences.

In the case of Ant file and directory operations, I'm pretty sure that item #2 won't bite you, but why take chances? Look for a "${basedir}war" directory that you can't account for. If you find one, that was the problem.


An IDE is no substitute for an Intelligent Developer.
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Thanks for the tip! I incorporated you suggestion with my script and I solved the problem by changing project tag's default attribute to setup-war-structure instead of compile.


Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2549
    
  10

Timothy, your signature nicely matches the problem you had.

Regards, Jan


OCUP UML fundamental and ITIL foundation
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Only that I wanted it to be made using ant and not by hand.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant - Directory not created
 
It's not a secret anymore!