Building a Java based snap

Hello everyone,
I’m trying to build a snap for a Java based application however I encountered an error when using the build facilities offered by snapcraft.io

The snap file is located at https://github.com/jreleaser/jreleaser-snap/blob/master/snap/snapcraft.yaml reproduced here in its entirety

name: jreleaser
base: core18
version: 0.1.0
license: Apache-2.0
grade: stable
type: app
confinement: strict
summary: Release Java projects quickly and easily with JReleaser
description: Release Java projects quickly and easily with JReleaser

apps:
  jreleaser:
    command: bin/jreleaser
    environment:
      JAVA_HOME: $SNAP/usr/lib/jvm/java

parts:
  jreleaser:
    plugin: dump
    source: https://github.com/jreleaser/jreleaser/releases/download/v0.1.0/jreleaser-0.1.0.tar
    source-checksum: sha256/0739da6d4ecc2af83cdcf3897a3e884f33b42b72644b28bde1ff6adc5357bf18
    stage-packages:
      - openjdk-8-jdk
    organize:
      usr/lib/jvm/java-8-openjdk*: usr/lib/jvm/java

I get a build failure stating

package contains external symlinks: usr/lib/jvm/java/jre/lib/security/cacerts lint-snap-v2_external_symlinks 

As I recall I read on a tutorial that organizing Java runtime files is the preferred option.
I’m new to crafting snaps and I’ll appreciate any hints to fix the snap file.

Thanks!
Andres

FWIW I found a solution by looking at https://github.com/popey/shattered-pixel-dungeon-snap/blob/master/snap/snapcraft.yaml

  • made sure paths are fully qualified
  • added missing network and home plugs
  • added ca-certificates to stage-packages
  • perhaps most importantly, excluded the offending symlinks