Joanis Joanis - 8 days ago 9x
Java Question

How to use FatJar (out of Eclipse) in continuous integration server?

From what I understood, FatJar is an Eclipse plugin which is based on the OSGi framework. I believe this makes it hard to use outside of an OSGi platform. Also, looking at decompiled FatJar, it seems to be requiring lots of OSGi and Eclipse classes, like

, for example.

So, in front of all this, I'm wondering if there is any way to use our precious *.fatjar files with Hudson (using a script or whatever).

Any good advice is welcome!


After more work and research, it seems that, even though FatJar is primarily an Eclipse plugin, it is possible to integrate it quite easily in continuous integration servers.

In my case, using Ant, I have found that it was possible to run the FatJar plugin outside of Eclipse using the following code (originally from this site).

<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:            -->
    <!--       -->
    <!-- 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="" 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">
      < 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=""/>

I uncommented the block of 6 lines at the beginning and it's working good. Reading the comment on top, it seems this was exported using FatJar itself, but don't know how to do this. I just adjusted this sample to my use case.