How to package OpenJDK 11 / OpenJFX 11 desktop application?

I’m trying to use snapcraft to package a Java 11 desktop application. It works fine on Ubuntu Cosmic because I can install openjdk-11-jre and openjfx via apt.

But since snapcraft is using the xenial repository, I can’t build a snap, because The package 'openjdk-11-jre' was not found.

Is there a way to build a snap package but using cosmic package repository?

If you use the new core18 base you should be good to go. More info:

And an example of a snap using it:

Thanks! base: core18 does help with openjdk-11-jre.

Next roadblock is openjfx which is for Java 8 on bionic but Java 11 on cosmic:

Is there any way to use cosmic as base? Or to somehow use the cosmic package for this particular package?

Not that I know.

Hmm, that’s a good question and I don’t know for sure, but I would say that an option would be to install the package “manually” during snap creation…