• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ANT: Getting resource files moved to classes folder for JAR

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whadoyagot?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 11865
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg,

Try this:



Regards, Andrew
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I do:

 
Daniel Mayer
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic