• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant Copy binary files best practice?

 
Clyde Lo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked http://ant.apache.org/manual/CoreTasks/copy.html#encoding , starting from Important Encoding Note ?
 
Clyde Lo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic