I am using the snapcraft maven plugin to build a snap based on a maven spring-boot project. My initial experiment worked fine, as the build only contained one maven module.
Now I've created a maven project, where a snap build is only one possible option for deployment, so I've created several "deployment" modules, that each contain an "application" module, which represents one SpringBoot application and all use the shared base modules.
My problem now is, that the plugin seems to build the entire project and then seems to pack in all the jars of all the modules and now I have multiple "root applications" for my SpringBoot-based application.
So how can I tell the plugin to build the entire project, but only to bundle certain artifacts?
parts:
# Build the project
build:
plugin: maven
source: .
source-type: local
build-packages:
- openjdk-17-jdk-headless
- maven
stage-packages:
- openjdk-17-jre-headless
I would now like to only use the jar in "deplyoments/snap-deployment/application/target".
I am using core22, so it seems I can't use the "maven-options" ... if I do I keep on getting errors, that claim that this property doesn't exist and the only examples I could find that used it, are based on core18.
Having a look at the content of the generated snap, I would like everything to be included as it currently is, however to only have a single jar file located in the squashfs-root/jar directory.
How can I achieve this?