I have begun working on a project that, at the moment, produces a monolithic JAR file from an Eclipse project. Basically, there is an Ant script that runs anytime the Eclipse Java Builder runs and takes the output of the Eclipse Java Builder (the .class files) and packages that up into a JAR file. That JAR file is then placed in a common directory so other tools can grab it for the latest build.
This works well for the team so I don't want to change it too much, but, there are a lot of unnecessary files within that JAR making it much larger than it needs to be. I was wondering if it was possible, within the same sort of framework as I described above (Eclipse + Ant), to split up the big JAR file into smaller, more manageable JAR files. For example:
com.company.project.thing1 com.company.project.thing2 com.company.project.thing3
All three things are packaged into the JAR. Instead, I only want thing1 and thing2 in one JAR file and thing3 to be in a second JAR file.
I do realize I could have separate projects, but I wanted to see if it was possible to keep the project grouped together still as that does make sense. Any help would be much appreciated.
Thank you.
Per request, the Ant Build Script (I only included the jar task - the other is just a clean):
<target name="jar" description="Deploys the JAR file." depends="clean">
<mkdir dir="${dir.dist}">
<!-- Build the JAR file containing the classes. -->
<jar destfile="${dir.dist}/${build.name}.jar">
<!-- Generate the MANIFEST.MF file. -->
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Release-Version" value=${version}" />
</manifest>
<zipfileset dir="${dir.build}" />
</jar>
</target>