Print at Dec 20, 2025, 6:31:47 PM

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.