Maven plugin missing in core20

snapcraft list-plugins --base core20

autotools catkin catkin-tools cmake colcon conda dump go make meson nil npm python qmake rust

vs.

snapcraft list-plugins --base core18

ant catkin-tools conda dump godeps kernel meson plainbox-provider ruby waf autotools cmake crystal flutter gradle make nil python rust catkin colcon dotnet go kbuild maven nodejs qmake scons

2 Likes

Just following up on Regal’s post. Is there any plan to add the Maven plugin to core 20 (or perhaps core22)? At some point we java/maven developers will need to get off of core18.

Thank you,

Michael

The parts lifecycle was extracted from Snapcraft to the craft-parts library, and most plugins are now defined there (except plugins that are specific to snaps, such as ROS – these will still be in Snapcraft). Snapcraft 7 uses this library to create core22 snaps.

Please open an issue in https://github.com/canonical/craft-parts/issues requesting the Maven plugin to be ported so we can add it to the development backlog.

1 Like

Thank you cmatsuoka. I’ve created issue #236 per your request.

LINK to GitHub Issue

Thank you very much.

Michael

1 Like

Hello all. With support stopping for 18.04LTS in a few months, is there plans to support maven in core22 and onwards? I’m really enjoying deploying via snaps, but without maven support, I’ll probably need to stop in April.

I’d appreciate it if the devs can let us Java programmers know your plans moving forward.

For Core22 I see the following:


frosty@odin[~]$ snapcraft list-plugins
Displaying plugins available for 'core22'
autotools
cmake
dotnet
dump
go
meson
make
nil
npm
python
rust
colcon
conda

I’ve also posted this request for an update on the GitHub discussion per @cmatsuoka 's comments above. Thank you,

Michael

Hello @frossty, can you point me to a project I could use to test a maven plugin port/reimplementation?

1 Like

Hello cmatsuoka. Here are several of my projects that could be used.

The simplest application is:

I’m also happy to help in any way I can. Thank you for your help - I really appreciate it.

Michael

1 Like

Hi @cmatsuoka

If you want to test with a slightly more complex project including a AWT/Swing GUI: https://github.com/RetGal/Dayon

Would also be happy if I could help you regarding this issue!

Regards, Reto

1 Like

Ohhh great!! i hope you can port Maven plugin too :slight_smile:

Here is another project which uses it:

https://bitbucket.org/eloy_garcia_pca/wallpaperdownloader/src/master/snap/

Thank you very much!

1 Like

Some news on the core22 maven plugin: we have some initial code that reuses common infrastructure created for the ant plugin, and core22 dirsize seems to be working as expected:

$ grep base snap/snapcraft.yaml 
base: core22

$ dirsize
DirSize v2.2.17
Copyright 2011-2022 by Michael Fross

Scanning /home/claudio/snapcraft/maven/dirsize: [Complete]
------------------------------------------------------------------------------------------
Directory                           Size        Files    Size Map [880.777 KB/slot]
------------------------------------------------------------------------------------------
[RootDir]                     135.392 MB            7    [ooooooooooooooooooooooooooooooo]
.git                           27.305 MB           26    [ooooooooooooooooooooooooooooooo]
graphics                        4.054 MB            4    [oooo---------------------------]
src                            38.093 KB            6    [-------------------------------]
tools                           2.053 KB            1    [-------------------------------]
snap                            1.372 KB            2    [-------------------------------]
.settings                       1.003 KB            3    [-------------------------------]
------------------------------------------------------------------------------------------
Directories: 7                 31.401 MB           49

Scanning Time: 27 ms (1.815 files/ms)
1 Like

Great news! Thank you very much for your work on this issue. I hope we can use it very soon on production :slight_smile:

It took a while but an implementation of the Maven plugin for core22 just landed on the Snapcraft repository and should be available for testing in the edge channel soon. Please test and report problems so we can fix them before the next stable version is released.

There are some differences in this plugin compared to the old core18 plugin, and the main one is that the JDK and JRE should now be provided manually (in most cases this means listing them in build-packages and stage-packages, but you can also do a custom install to use something that’s not from the distribution archives).

You may also want to add a lint filter to prevent Snapcraft from showing false positives about missing libraries, something like the following should work:

lint:
  ignore:
    - library:
        - usr/lib/jvm/java-*/lib/*.so

Here is an example of how a part definition using the new plugin could look like:

parts:
  mkpass:
    plugin: maven
    source: https://github.com/frossm/mkpass.git
    build-packages:
      - openjdk-11-jdk-headless
      - maven
    stage-packages:
      - openjdk-11-jre-headless
2 Likes

Thank you very much for your work!! :slight_smile:

1 Like

I wanted to test the Maven plugin for core22, but the build gives me:

    Running on amd64 for amd64
    Bad snapcraft.yaml content:
    - plugin not registered: 'maven' (in field 'parts.dayon')

Does this simply mean, that the plugin is not available yet?

snapcraft.yaml

Make sure you’re using Snapcraft from the edge channel (snap refresh snapcraft --edge). The new plugins are not available in the stable channel yet. You’ll also need to manually expand filesets until it’s implemented for base core22.

There is a new way to pass cli params to Maven:

core18 plugin:

    maven-options:
        [-Psnap]

core22 plugin:

    maven-parameters:
        [-Psnap]

Yes, this was changed to be consistent with the rest of core22 plugins (make-parameters, scons-parameters, etc).

Thank you very much, great job, works like a charm!

For comparison:

core18: snapcraft.yaml

core22: snapcraft.yaml

1 Like