Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant adding backslash before colons in database URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant adding backslash before colons in database URL" Watch "Ant adding backslash before colons in database URL" New topic
Author

Ant adding backslash before colons in database URL

Michael Freake
Greenhorn

Joined: Jun 03, 2009
Posts: 24
Hello,

Ant is not behaving the way I would like. It is adding a "\" before my colons in a database URL.

Expected output:


Actual output:


The part in build.xml that does this:


From my build.properties, the value referenced above:


I do not want to use the <replace file="..." token="..." value="..."/> because we have several developers working on this project and the token being searched for may not be the same on each developer's machine.

Any ideas?

Thanks,
Mike
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19728
    
  10

It looks like Ant thinks it's generating a properties file, since escaping colons like that is mandatory in a properties file. If you don't want a properties file, perhaps you should use some Ant task other than "propertyfile".
Michael Freake
Greenhorn

Joined: Jun 03, 2009
Posts: 24
Thanks Paul,

I had no idea that was the case in properties files. I just read some more about it here: http://download.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)

I will be now be using the <replace .../> to avoid this.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Ant adding backslash before colons in database URL
 
It's not a secret anymore!