Gradle Plugin / dump plugin with jre dependency

Matthew Aguirre matt.aguirre at gmail.com
Thu Dec 29 17:06:11 UTC 2016


If you need the JDK (not just the jre), you should be able to do the 
following:

>     stage-packages:
>       - fontconfig-config
>       - default-jdk
>       - fonts-dejavu-extra
>       - fonts-ipafont-gothic

In your snapcraft.yaml file instead of just using including the jre.

If this is your complete snapcraft.yaml file, you may also need:
>     plugs: [home, x11, opengl, network, unity7]
or a subset of these.

There are some limitations with Java that I've found.

Here is my wrapper:
> #!/bin/bash
> 
> # Not good, needed for fontconfig
> export XDG_DATA_HOME=$SNAP/usr/share
> # Font Config
> export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
> export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
> export HOME=$SNAP_USER_DATA
> 
> export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/x86_64-linux-gnu/dri
> export LIBVA_DRIVERS_PATH=$SNAP/usr/lib/x86_64-linux-gnu/dri
> export LIBGL_DEBUG=verbose
> 
> export PATH=$PATH:/usr/local/bin
> 
> java -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel 
> -Duser.home=$HOME -Dsun.java2d.opengl=true -jar 
> $SNAP/jar/torgo-1.4.1.jar "$@"

You must set the user.home directory this way for the application to 
work (unless this has been fixed).

As far as updating gradle.  Put in a LaunchPad bug and register an 
Issue.  While I added the gradlew plugin, I am not a gradle user, so I 
can definitely work on adding/fixing work.

If the application tries to use xdg-open or open a web-browser, there 
are more fixes that are needed in my experience.
--
Matt

On Thu, Dec 29, 2016 at 4:46 AM, Felix Natter <fnatter at gmx.net> wrote:
> Dear snapcraft experts,
> 
> I am creating a simple snap for a java application:
> 
> BTW: My original post is here:
> http://askubuntu.com/questions/865090/simple-java-snap-with-jre-dependency
> 
> name: freeplane-snap
> version: 1.5.18-1
> summary: Java program for working with Mind Maps
> description: ...
> confinement: devmode
> grade: stable
> 
> apps:
>   freeplane-snap:
>     command: ./freeplane.sh
> 
> parts:
>   main:
>     plugin: dump
>     source: freeplane-1.5.18/
>     stage-packages: [openjdk-8-jre]
>     filesets:
>       mybuild:
>         - "*"
>     stage:
>       - $mybuild
>     snap:
>       - $mybuild
> 
> Freeplane uses a gradle build system, but the snapcraft gradle plugin 
> is
> not powerful enough (expects "gradlew" to be there and not "gradle", 
> and
> is used for single jar projects, i.e. always with 'jar' option). Where
> can I submit feature requests / patches for this?
> 
> So I am using the project's binary distribution (unzipped to
> ./freeplane-1.5.18) with the 'dump' plugin, which works well. However,
> since I'm not using a java build system, the jre is missing in the 
> snap
> (when running "freeplane-snap" I get an error that the JDK cannot be
> found, NOT when running freeplane.sh directly). I tried to add it with
> 'stage-packages: [openjdk-8-jre]' but this did not help.
> 
> Could you please tell me how to add the jre to the mix?
> 
> One more question: Hearing about this containment stuff, is it
> possible/feasible (using plugs?) to to create a desktop application 
> that
> can read and write (mind maps) from/to everywhere, just like a normal
> .deb? (like plugs: [network, home, tmp]?)
> I also need to install the desktop file and mime type mappings to
> /usr/share/... --> I assume I can do this with separate parts?
> 
> Many Thanks and Best Regards,
> --
> Felix Natter
> 
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/snapcraft
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161229/8d119dae/attachment.html>


More information about the Snapcraft mailing list