經過更多的工作和研究,似乎即使FatJar主要是一個Eclipse插件,也可以很容易地將它集成到持續集成服務器中。
在我的情況下,使用Ant,我發現可以使用下面的代碼(最初來自this site)在Eclipse之外運行FatJar插件。
<project name="FatJar MySuperDuperClass.jar (experimental)" default="main" basedir=".">
<!-- this file was created by Fat-Jar Eclipse Plug-in -->
<!-- the ANT-Export is in a very early stage, so this -->
<!-- is only experimental, ANT 1.6 or above is -->
<!-- required, feedback is always welcome: -->
<!-- http://sourceforge.net/projects/fjep -->
<!-- uncomment the following lines if using ANT outside Eclipse -->
<!--
<property name="fjepPath" value="plugins/net.sf.fjep.fatjar_0.0.31/fatjar.jar"/>
<taskdef name="fatjar.build" classname="net.sf.fjep.anttask.FJBuildTask" classpath="${fjepPath}"/>
<typedef name="fatjar.manifest" classname="net.sf.fjep.anttask.FJManifestType" classpath="${fjepPath}"/>
<typedef name="fatjar.exclude" classname="net.sf.fjep.anttask.FJExcludeType" classpath="${fjepPath}"/>
<typedef name="fatjar.jarsource" classname="net.sf.fjep.anttask.FJJarSourceType" classpath="${fjepPath}"/>
<typedef name="fatjar.filesource" classname="net.sf.fjep.anttask.FJFileSourceType" classpath="${fjepPath}"/>
-->
<!-- uncomment the above lines to use ANT outside of Eclipse -->
<target name="main">
<fatjar.build output="MySuperDuperClass.jar">
<fatjar.manifest mainclass="de.schwobeseggl.test.MySuperDuperClass"/>
<fatjar.filesource path="bin" relpath=""/>
<fatjar.jarsource file="lib/commons-cli.jar" relpath=""/>
<fatjar.jarsource file="lib/jbossall-client.jar" relpath=""/>
<fatjar.jarsource file="lib/junit.jar" relpath=""/>
<fatjar.jarsource file="lib/log4j.jar" relpath=""/>
<fatjar.jarsource file="lib/jdom.jar" relpath=""/>
</fatjar.build>
</target>
</project>
我在開始時取消註釋了6行代碼塊,它的工作良好。閱讀頂部的評論,似乎這是使用FatJar本身導出的,但不知道如何做到這一點。我只是將這個示例調整到我的用例。