aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT: Getting resource files moved to classes folder for JAR 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: Getting resource files moved to classes folder for JAR" Watch "ANT: Getting resource files moved to classes folder for JAR" New topic
Author

ANT: Getting resource files moved to classes folder for JAR

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Alright, this is probably something simple, but I can't figure out what the heck to do. I have a project where I have some image files and some .obj files I need access to from within my JAR file. So I just packaged them up in my src folder like so.



Hopefully, you get the idea. So when I run my ANT compile task, the image folder and files are moved to the classes folder. However, the models folder and files are ignored. I tried doing a copy task before the JAR task but I can't seem to get the correct syntax to copy the complete directory structure for the models folder. Can someone help me out on this? Is there another way to do this?

FYI - interestingly enough, in IDEA, building the project with it's builder (not ANT) also moved the images but not the models to the classes folder from the src folder.


GenRocket - Experts at Building Test Data
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Whadoyagot?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Try this:


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Originally posted by Lasse Koskela:
Try this:


Lasse, that almost works and that's almost what I had. Problem is it excludes creating the data folder which I need.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Ok, nevermind. I got it to work. Now I have:



And all is well in my strange little world. Thanks!
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11525
    
100

Hi Gregg,

Try this:



Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
This is what I do:



Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Daniel Mayer
Ranch Hand

Joined: Sep 09, 2004
Posts: 103
In some languages, obj-files are intermediary files that are created during compilation but not necessary for program execution, if I remember correctly. That might explain why some tools ignore them by default. Mhh, on the other hand they don't seem to be in the default excludes: http://ant.apache.org/manual/dirtasks.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ANT: Getting resource files moved to classes folder for JAR