Print at Dec 20, 2025, 9:16:14 PM View all posts in this thread on one page
Posted by lnk7 at Aug 12, 2015, 2:32:40 AM
Add folder to compile using ant and build.xml
Hello

I added a folder in the project and would like to know how to add this folder on build.xml to compile the ant to generate the .jar

I tried to add <include name = "folder/**"/> under <include name = "src/**"/> in build.xml
But the ant does not add it and when you run the jar, the part that depends on the folder does not run.

Posted by clanmills at Aug 12, 2015, 10:28:39 AM
Re: Add folder to compile using ant and build.xml
My project (ToWebPlugin.jar) uses two libraries which are not part of SH3D. They are json-simple-1.1.1.jar and ST-4.0.8.jar. I've added them in Eclipse and everything is good for running/debugging from Eclipse.

To get ToWebPlugin.jar to "see" the libraries for json-simple and ST at run-time outside of Eclipse, I included a "raw" copy of the classfiles from json-simple and ST in ToWebPlugin.jar I did this using a little bash script which rewrites the ToWebPlugin.jar to include the class trees from json-simple and ST. The script does this:

1 Expands ST and json-simple into the temporary directory (with jar xf)
2 Expands ToWebPlugin.jar into a temporary directory (with jar xf)
3 Generates a new ToWebPlugin.jar from the temporary directory (with jar cf)

This has the restriction that ToWebPlugin.jar contains a local copy of the ST and json-simple classfile trees. So, that code isn't shared with SH3D or other plugins. However both ST.jar and json-simple.jar are modest in size and add about 400k to ToWebPlugin.jar which is about 500k before being rebuilt. The redistributable ToWebPlugin.jar is about 900k and works fine on Mac/Windows/Linux.

I haven't investigated how to achieve the unpack/repack jar using ant/maven or any of the Eclipse build magic. When I export a new copy of ToWebPlugin from Eclipse, I have to manually run my build script. Automating this from Eclipse is on my (long) TODO list.

Posted by lnk7 at Aug 14, 2015, 1:35:47 AM
Re: Add folder to compile using ant and build.xml
It has no way to include the folder by build.xml?
I needed to build the build.xml with this folder

Posted by Puybaret at Aug 14, 2015, 3:04:29 AM
Re: Add folder to compile using ant and build.xml
The documentation page about Ant javac task gives all the détails you need about its includes attribute.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator