Add folder to compile using ant and build.xml

This topic has been viewed 7825 times and has 3 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
lnk7
Newbie
Posts: 3
Joined: Wed Mar 11, 2015 2:41 am

Add folder to compile using ant and build.xml

Post by lnk7 »

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.
User avatar
clanmills
Member
Posts: 33
Joined: Fri May 16, 2014 4:50 am
Country: Camberley, Surrey, England
Contact:

Re: Add folder to compile using ant and build.xml

Post by clanmills »

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.
lnk7
Newbie
Posts: 3
Joined: Wed Mar 11, 2015 2:41 am

Re: Add folder to compile using ant and build.xml

Post by lnk7 »

It has no way to include the folder by build.xml?
I needed to build the build.xml with this folder
User avatar
Puybaret
Expert
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Add folder to compile using ant and build.xml

Post by Puybaret »

The documentation page about Ant javac task gives all the détails you need about its includes attribute.
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic