Can't get Snapcraft to create maven project

103 Views Asked by At

I'm pretty new to snapcraft, and would like to publish an app on the Snap store. I created an application using javafx and compiled with maven. I have an executable jar that I would like to run. However, I cannot seem to configure my yaml file in a way that doesn't produce an error.

I have tried as many variations as I can think of with no avail.

system details:

Ubuntu 22.04.3 LTS
Apache Maven 3.6.3
Snapcraft 7.5.4
java 21.0.1 2023-10-17 LTS

This is the most recent version of my yaml file:

name: green-collectives
base: core22
version: '1.0'
summary: Green Collectives - JavaFX Application
description: |
  A Desktop Application built with javaFx with the intention of solving relevant problems and inefficiencies that U.S. Army Service members, and gun enthusiasts face on a daily basis.

grade: stable
confinement: devmode

apps:
  green-collectives:
    command: java -jar $SNAP/target/greenSociety-1.0-SNAPSHOT-shaded.jar
    environment:
      JAVA_HOME: "$SNAP/home/tyty/.sdkman/candidates/java/21.0.1-oracle/bin"

parts:
  green-collectives:
    plugin: nil
    stage-packages:
      - default-jre

This particular yaml produces the error:

Command '['snap', 'pack', '--filename', 'green-collectives_1.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.                                                     
Failed to execute pack in instance.                                            
Recommended resolution: Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

I have also tried running as a maven project with the following yaml change:

parts:
  green-collectives:
    plugin: maven
    source: https://github.com/tcdickson/Green-Collectives.git
    source-type: git
    source-tag: master

with an error of:

Environment validation failed for part 'green-collectives': 'mvn' not found and part 'green-collectives' does not depend on a part named 'maven-deps' that would satisfy the dependency.   

I have maven installed, and the project is compiled and packaged with maven

0

There are 0 best solutions below