Fat-jar deployment method - ant recipe

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Fat-jar deployment method - ant recipe

hharrison
Just a snapshot of what I've been playing with to deploy a simgle jar...suggestions/improvements very welcome:

  <target name="jar" depends="compile">
    <jar jarfile="${build.dir}/jars/JaamSim.jar" manifest="Manifest.MF"
         compress="true" update="yes">
      <fileset dir="${class.dir}"/>
      <fileset dir="${res.dir}"/>

      <zipfileset src="jar/gluegen-rt.jar"     includes="jogamp/**/*"/>
      <zipfileset src="jar/gluegen-rt.jar"     includes="com/**/*"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
      <zipfileset src="jar/jogl-all.jar"       includes="jogamp/**/*"/>
      <zipfileset src="jar/jogl-all.jar"       includes="javax/**/*"/>
      <zipfileset src="jar/jogl-all.jar"       includes="com/**/*"/>
      <zipfileset src="jar/jogl-all-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/jogl-all-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/jogl-all-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/jogl-all-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/jogl-all-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
    </jar>
  </target>
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

gouessej
Administrator
This post was updated on .
Hi

There are already this (in a bug report) and that (under GPL v2).

I like your idea of using the prefix in the zipfileset. Moreover, you don't include too much things, good job :) Maybe you can use a single line for gluegen-rt.jar and jogl-all.jar by putting several filters into "includes".

Edit.: Why not including all .class files instead of filtering on the package names?
Edit.2: I would be glad to know whether you could be interested by the native packaging tool that I have to create to replace Java Web Start. It is intended to create native installers from JARs, a single fat JAR isn't necessary. I plan to use Red Line for RPMs, jpkg for DEBs, appbundler for APPs and Apache POI for MSIs. The 3 first ones are already ready to be used with Ant. Apache POI handles the structured file format of MSI files but nothing really specific to the MSI installers unlike Wix.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

hharrison
After checking, I left out the newt/data/ folder from the jogl-all.jar, actually produces a null pointer exception as some default window icons are not found...only on X11 though.

I'll post a cleaned up version tomorrow with the filters updated and the missing data folder added.  The single-jar deployment is pretty attractive, but I'll have a look at your native packaging tool and see what it offers.  Currently we're delivering exe4j packaged executables, the fat jar is for everyone on non-windows for now.

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

gouessej
Administrator
This post was updated on .
hharrison wrote
After checking, I left out the newt/data/ folder from the jogl-all.jar, actually produces a null pointer exception as some default window icons are not found...only on X11 though.
There is an image in jogl.util.data.av too and there are some shaders in jogamp.opengl.shader. Why not rather including all class, png, glsl, vp and fp files?

hharrison wrote
The single-jar deployment is pretty attractive
It's attractive when the default archiver doesn't get in your way (WinZip, WinRar, Ark, ...).

hharrison wrote
, but I'll have a look at your native packaging tool and see what it offers.
It's still a "work in progress" feature but you can already use the tools that I will use under GNU Linux and Mac OS X. Microsoft Windows will be harder to support.

hharrison wrote
Currently we're delivering exe4j packaged executables, the fat jar is for everyone on non-windows for now.
Therefore, appbundler + Red Line + jpkg would just improve a bit the native integration, you wouldn't be bothered by the default archiver. exe4j is known to be worse than launch4j (not sure it handles relative paths correctly). I haven't tested jsmooth (it generates larger executables) and winrun4j. NSIS can be used for Java applications too.

Edit.: Keep in mind that you can't set the maximum heap size when using a single JAR without any script or Java Web Start whereas Red Line / jpkg / appbundler don't prevent you from doing that (in the script that runs "java -jar"). The fat "executable" JAR is nice when you can use your application with the default values of the JVM. Only a very few things can be set directly in the manifest.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

gouessej
Administrator
In reply to this post by hharrison
Better than words...:

<target name="jar" depends="compile">
    <jar jarfile="${build.dir}/jars/JaamSim.jar" manifest="Manifest.MF"
         compress="true" update="yes">
      <fileset dir="${class.dir}"/>
      <fileset dir="${res.dir}"/>

      <zipfileset src="jar/gluegen-rt.jar"     includes="**/*.class"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
      <zipfileset src="jar/jogl-all.jar"       includes="**/*.class,**/*.png,**/*.glsl,**/*.vp,**/*.fp,**/*.bvp,**/*.bfp"/>
      <zipfileset src="jar/jogl-all-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/jogl-all-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/jogl-all-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/jogl-all-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/jogl-all-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
    </jar>
  </target> 
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

hharrison
This is what I was just finishing pushing out, not sure I really care that much about file filtering as opposed to my somewhat naive folder-based filtering:

  <target name="jar" depends="compile">
    <jar jarfile="${build.dir}/jars/JaamSim.jar" manifest="Manifest.MF"
         compress="true">
      <fileset dir="${class.dir}"/>
      <fileset dir="${res.dir}"/>
      <zipfileset src="jar/gluegen-rt.jar"     includes="jogamp/**/*,com/**/*"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/gluegen-rt-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/gluegen-rt-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
      <zipfileset src="jar/jogl-all.jar"       includes="jogamp/**/*,javax/**/*,com/**/*,newt/**/*"/>
      <zipfileset src="jar/jogl-all-natives-windows-i586.jar"     includes="*.dll"    prefix="natives/windows-i586"/>
      <zipfileset src="jar/jogl-all-natives-windows-amd64.jar"    includes="*.dll"    prefix="natives/windows-amd64"/>
      <zipfileset src="jar/jogl-all-natives-linux-i586.jar"       includes="*.so"     prefix="natives/linux-i586"/>
      <zipfileset src="jar/jogl-all-natives-linux-amd64.jar"      includes="*.so"     prefix="natives/linux-amd64"/>
      <zipfileset src="jar/jogl-all-natives-macosx-universal.jar" includes="*.jnilib" prefix="natives/macosx-universal"/>
    </jar>
  </target>
Reply | Threaded
Open this post in threaded view
|

Re: Fat-jar deployment method - ant recipe

gouessej
Administrator
Ok it's correct.

Have you ever tested the trusted free of charge certificates provided by Certum?
http://www.certum.eu/certum/cert,offer_en_open_source_cs.xml

I'm going to give it a try soon in order to get rid of the nasty warnings until I will be ready to stop using Java Web Start once for all.
Julien Gouesse | Personal blog | Website