aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant Copy binary files best practice? 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 Copy binary files best practice?" Watch "Ant Copy binary files best practice?" New topic
Author

Ant Copy binary files best practice?

Clyde Lo
Greenhorn

Joined: Mar 15, 2010
Posts: 2
HI,

I currently have a project where I have a couple of jar files sitting in lib/ . I naively used an ANT build file to copy (obviously with fileset..todir blah) across the binary jar files to some other deploy directory. This resulted in corrupted jars.

I am sure taht other people came across the same issue and was wondering how did you get pass this? Is there some common practice.?

Your input is greatly appreciated.

Thanks
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Have you checked http://ant.apache.org/manual/CoreTasks/copy.html#encoding , starting from Important Encoding Note ?
Clyde Lo
Greenhorn

Joined: Mar 15, 2010
Posts: 2
HI Misha,

Thanks for your reply.

I did read the copy specifications. I was hoping to get an idea of how do others people move binaries around in Ant in their projects. I am planning to break my copy task into two one with filter and the other without. That is the only way I can think of (not very clean in my view).

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Clyde Lo wrote:HI Misha,

Thanks for your reply.

I did read the copy specifications. I was hoping to get an idea of how do others people move binaries around in Ant in their projects. I am planning to break my copy task into two one with filter and the other without. That is the only way I can think of (not very clean in my view).



I ran into the same problem long ago, but mixing binary and text files (if you can avoid it) is itself not a very clean approach. You're better off keeping 2 directories, one for the text (filtered) items, and one for the binary files, and doing 2 copies.

Yes, it makes the build.xml file (and directory structure) slightly more complex, but it makes the overall project structure more straighforward.

One thing that using J2EE frameworks has taught me is that less files doesn't necessarily make a project simpler to work with. Otherwise I'd still be cramming everything into logic on JSPs.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
wood burning stoves
 
subject: Ant Copy binary files best practice?