Wednesday, April 20, 2011

Create a single jbossall-client.jar bundle in JBoss 5.0.x?

Since JBoss 5.0.0, jbossall-client.jar only contains a manifest that points to all the jars in the client directory. Is there any way to create a jbossall-client.jar that contains all of these classes instead of having to put the 70 or so individual jars on the classpath?

From stackoverflow
  • Combining all client jars to a single jar may not be recommended. However if you are keen to see a single jar with all classes loaded in it one approach would be to write an ant script which can unjar the required jars to a temp dir and then make a single jar of the classes in the temp dir.

       <target name="unjar.jar">
            <unjar dest="${temp.dir}">
                  <patternset>
                        <include name="**/*.class" />
                  </patternset>
                  <fileset dir="${lib.dir}">
                        <include name="**/*.jar" />
                  </fileset>
            </unjar>
      </target>
    
    
      <target name="combine.jar" depends="unjar.jar">
            <jar jarfile="${base.dir}/${jar.filename}"
                  basedir="${temp.dir}" includes="**/*.class" update="true"
                  compress="false">
            </jar>
            <delete dir="${temp.dir}" quiet="true" />
      </target>
    
    Andrew : Yes, I know that they decided to use the manifest method to allow users to swap out individual jars if necessary. However, they used to create a single jar client and other app servers such as Weblogic have a JarBuilder tool to accomplish this. I think your method may do the trick, thanks.

0 comments:

Post a Comment