diff --git a/tests/spread/rockcraft/plugin-jlink/bare-build-2404/rockcraft.yaml b/tests/spread/rockcraft/plugin-jlink/bare-build-2404/rockcraft.yaml
new file mode 100644
index 000000000..16eb00810
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/bare-build-2404/rockcraft.yaml
@@ -0,0 +1,3 @@
+base: bare
+build-base: ubuntu@24.04
+name: bare-build-2404
diff --git a/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/pom.xml b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/pom.xml
new file mode 100644
index 000000000..202cd3507
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/pom.xml
@@ -0,0 +1,84 @@
+
+
+
+ 4.0.0
+
+ helloworld
+ helloworld
+ 1.0-SNAPSHOT
+
+ helloworld
+
+
+ UTF-8
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+
+ maven-resources-plugin
+ 3.0.2
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ maven-surefire-plugin
+ 2.22.1
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ true
+ helloworld.App
+
+
+
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+
+ maven-site-plugin
+ 3.7.1
+
+
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+
+
diff --git a/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/main/java/com/yourcompany/helloworld/App.java b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/main/java/com/yourcompany/helloworld/App.java
new file mode 100644
index 000000000..f39741d1f
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/main/java/com/yourcompany/helloworld/App.java
@@ -0,0 +1,13 @@
+package com.yourcompany.helloworld;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
diff --git a/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/test/java/com/yourcompany/helloworld/AppTest.java b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/test/java/com/yourcompany/helloworld/AppTest.java
new file mode 100644
index 000000000..d38f3be35
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/base-2404/helloworld/src/test/java/com/yourcompany/helloworld/AppTest.java
@@ -0,0 +1,20 @@
+package com.yourcompany.helloworld;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+{
+ /**
+ * Rigorous Test :-)
+ */
+ @Test
+ public void shouldAnswerWithTrue()
+ {
+ assertTrue( true );
+ }
+}
diff --git a/tests/spread/rockcraft/plugin-jlink/base-2404/rockcraft.yaml b/tests/spread/rockcraft/plugin-jlink/base-2404/rockcraft.yaml
new file mode 100644
index 000000000..dd3f99ce4
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/base-2404/rockcraft.yaml
@@ -0,0 +1,2 @@
+base: ubuntu@24.04
+name: base-2404
diff --git a/tests/spread/rockcraft/plugin-jlink/helloworld/pom.xml b/tests/spread/rockcraft/plugin-jlink/helloworld/pom.xml
new file mode 100644
index 000000000..bfe17cf69
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/helloworld/pom.xml
@@ -0,0 +1,82 @@
+
+
+
+ 4.0.0
+
+ com.yourcompany
+ helloworld
+ 1.0-SNAPSHOT
+
+ helloworld
+
+ http://www.example.com
+
+
+ UTF-8
+ 8
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+
+ maven-resources-plugin
+ 3.0.2
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ maven-surefire-plugin
+ 2.22.1
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ true
+ helloworld.App
+
+
+
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+
+ maven-site-plugin
+ 3.7.1
+
+
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+
+
diff --git a/tests/spread/rockcraft/plugin-jlink/helloworld/src/main/java/helloworld/App.java b/tests/spread/rockcraft/plugin-jlink/helloworld/src/main/java/helloworld/App.java
new file mode 100644
index 000000000..a983f8398
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/helloworld/src/main/java/helloworld/App.java
@@ -0,0 +1,13 @@
+package helloworld;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
diff --git a/tests/spread/rockcraft/plugin-jlink/helloworld/src/test/java/helloworld/AppTest.java b/tests/spread/rockcraft/plugin-jlink/helloworld/src/test/java/helloworld/AppTest.java
new file mode 100644
index 000000000..4cc61d672
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/helloworld/src/test/java/helloworld/AppTest.java
@@ -0,0 +1,20 @@
+package helloworld;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+{
+ /**
+ * Rigorous Test :-)
+ */
+ @Test
+ public void shouldAnswerWithTrue()
+ {
+ assertTrue( true );
+ }
+}
diff --git a/tests/spread/rockcraft/plugin-jlink/parts.yaml b/tests/spread/rockcraft/plugin-jlink/parts.yaml
new file mode 100644
index 000000000..986b26985
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/parts.yaml
@@ -0,0 +1,40 @@
+# Actual parts definition for the rockcraft + python cases that we are testing.
+# (this gets appended to all rockcraft.yaml files in the subdirectories in the
+# main task.yaml).
+
+version: "0.1"
+summary: A rock that bundles a Java project.
+description: A rock that bundles a Java project.
+license: GPL-3.0
+platforms:
+ amd64:
+
+parts:
+ helloworld:
+ source: helloworld
+ source-type: local
+ build-packages:
+ - openjdk-21-jdk
+ - maven
+ plugin: maven
+ build-environment:
+ - JAVA_HOME: "/usr/lib/jvm/java-21-openjdk-${CRAFT_ARCH_BUILD_FOR}"
+
+ deps:
+ plugin: nil
+ stage-packages:
+ - openjdk-21-jre-headless_standard
+ stage:
+ - -usr/lib/jvm
+
+ runtime:
+ after:
+ - helloworld
+ - deps
+ plugin: jlink
+ build-packages:
+ - openjdk-21-jdk
+ build-environment:
+ - JAVA_HOME: /usr/lib/jvm/java-21-openjdk-${CRAFT_ARCH_BUILD_FOR}
+ jlink-jars:
+ - jar/helloworld-1.0-SNAPSHOT.jar
diff --git a/tests/spread/rockcraft/plugin-jlink/task.yaml b/tests/spread/rockcraft/plugin-jlink/task.yaml
new file mode 100644
index 000000000..1e87a17da
--- /dev/null
+++ b/tests/spread/rockcraft/plugin-jlink/task.yaml
@@ -0,0 +1,29 @@
+summary: JLink plugin tests
+environment:
+ SCENARIO/base_2404: base-2404
+ SCENARIO/bare_build_2004: bare-build-2404
+execute: |
+ SCENARIO_DIR="${SCENARIO}"
+ ROCK_FILE="${SCENARIO}_0.1_amd64.rock"
+ IMAGE="${SCENARIO}:0.1"
+
+ # change into the scenario's directory
+ cd ${SCENARIO_DIR}
+
+ # add the parts definition, common to all scenarios
+ cat ../parts.yaml >> rockcraft.yaml
+
+ # copy the source of the project we're building (also shared)
+ cp -r ../helloworld .
+
+ # Build the rock & load it into docker
+ run_rockcraft pack
+ test -f ${ROCK_FILE}
+ sudo rockcraft.skopeo --insecure-policy copy oci-archive:${ROCK_FILE} docker-daemon:${IMAGE}
+ docker images
+ rm ${ROCK_FILE}
+
+ # Run the packaged project
+ docker run --rm $IMAGE exec /usr/bin/java -jar /jar/helloworld-1.0-SNAPSHOT.jar | MATCH "Hello World!"
+
+ docker system prune -a -f