diff --git a/.github/workflows/package-native-validation.yml b/.github/workflows/package-native-validation.yml
index e631457eb9614..e75c648c7ffe9 100644
--- a/.github/workflows/package-native-validation.yml
+++ b/.github/workflows/package-native-validation.yml
@@ -41,6 +41,8 @@ concurrency:
permissions:
contents: read
+# Use the project Maven wrapper throughout: runner-provided Maven versions can differ
+# from the version supported by this branch's build extensions.
jobs:
# ── macOS / Linux (POSIX validators) ──────────────────────────────
posix-validator:
@@ -81,6 +83,16 @@ jobs:
java-version: '21'
cache: 'maven'
+ # Packaging scripts invoke mvn themselves, so pin their PATH entry as well as
+ # the direct workflow commands. Keep the snapshot profile active in subprocesses.
+ - name: Pin Maven for packaging subprocesses
+ shell: bash
+ run: |
+ CAMEL_CI_MAVEN_HOME=$(./mvnw -q -B -P apache-snapshots -ntp -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
+ -Dexpression=maven.home -DforceStdout)
+ echo "$CAMEL_CI_MAVEN_HOME/bin" >> "$GITHUB_PATH"
+ echo "MAVEN_ARGS=${MAVEN_ARGS:-} -P apache-snapshots" >> "$GITHUB_ENV"
+
# camel-repackager-maven-plugin builds the launcher's self-executing JAR. It is not in the
# -pl list below, so without this step Maven resolves it from the Apache snapshot repository.
# This workflow only triggers on dsl/camel-jbang/camel-launcher and tooling/camel-exe changes
@@ -88,7 +100,7 @@ jobs:
- name: Install camel-repackager-maven-plugin (build-time plugin, unresolvable from this reactor pass)
shell: bash
run: |
- mvn -B -P apache-snapshots -ntp \
+ ./mvnw -B -P apache-snapshots -ntp \
-pl tooling/maven/camel-repackager-maven-plugin install -DskipTests
- name: Build camel-launcher distribution
@@ -98,14 +110,14 @@ jobs:
# published snapshot instead of being rebuilt from source, which is what previously turned
# this into a ~626-module reactor build. -P apache-snapshots is required for that resolution.
run: |
- mvn -B -P apache-snapshots -ntp \
+ ./mvnw -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-jbang/camel-launcher install -DskipTests
- name: Stage a synthetic release version for offline validation
shell: bash
run: |
cd dsl/camel-jbang/camel-launcher
- REAL_VERSION=$(mvn -q -B -ntp org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
+ REAL_VERSION=$(../../../mvnw -q -B -P apache-snapshots -ntp org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
-Dexpression=project.version -DforceStdout)
TEST_VERSION="${REAL_VERSION%-SNAPSHOT}"
echo "TEST_VERSION=$TEST_VERSION" >> "$GITHUB_ENV"
@@ -142,12 +154,12 @@ jobs:
# WebsiteInstallTest's PosixShell suite only gets targeted CI coverage today as a side
# effect of the generic incremental-build check noticing a direct change under
# dsl/camel-jbang/camel-launcher; a PR that only touches an upstream dependency wouldn't
- # trigger it. Run it here explicitly so this dedicated validation workflow covers it too.
+ # trigger it. Run it here explicitly, together with the POSIX launcher script tests.
run: |
cd dsl/camel-jbang/camel-launcher
- mvn -B -ntp test -pl . -Dtest=PackageNativeValidationTest,WebsiteInstallTest
+ ../../../mvnw -B -P apache-snapshots -ntp test -pl . -Dtest=PackageNativeValidationTest,WebsiteInstallTest,CamelShDiscoveryTest,FakeJavaTest
- # ── Windows (install.ps1 unit tests) ──────────────────────────────
+ # ── Windows (installer and launcher script unit tests) ──────────────────────────────
windows-validator:
runs-on: windows-latest
# Caps a genuine hang well below GitHub's 6h default; a passing run has taken up to ~25 minutes.
@@ -171,7 +183,7 @@ jobs:
- name: Install camel-repackager-maven-plugin (build-time plugin, unresolvable from this reactor pass)
shell: bash
run: |
- mvn -B -P apache-snapshots -ntp \
+ ./mvnw -B -P apache-snapshots -ntp \
-pl tooling/maven/camel-repackager-maven-plugin install -DskipTests
- name: Build camel-launcher module
@@ -181,16 +193,16 @@ jobs:
# published snapshot instead of being rebuilt from source, which is what previously turned
# this into a ~626-module reactor build. -P apache-snapshots is required for that resolution.
run: |
- mvn -B -P apache-snapshots -ntp \
+ ./mvnw -B -P apache-snapshots -ntp \
-pl buildingtools,dsl/camel-jbang/camel-launcher install -DskipTests
- - name: Run Windows installer unit tests
+ - name: Run Windows installer and launcher script unit tests
shell: bash
# The PowerShell suite has taken 10-20 minutes on windows-latest, straddling camel-launcher's 1200s
# surefire fork timeout, so slow-but-passing runs were killed. Give this job's fork more room.
run: |
cd dsl/camel-jbang/camel-launcher
- mvn -B -ntp test -pl . -Dtest=WebsiteInstallTest -Dcamel.surefire.forkTimeout=2700
+ ../../../mvnw -B -P apache-snapshots -ntp test -pl . -Dtest=WebsiteInstallTest,CamelBatDiscoveryTest,FakeJavaTest -Dcamel.surefire.forkTimeout=2700
# Per-test timings for the PowerShell suite, which runs close to camel-launcher's surefire fork timeout.
# A fork killed on that timeout writes no XML report; the per-process timings the fixture prints to the
diff --git a/dsl/camel-jbang/camel-launcher/src/main/assembly/launcher-content.xml b/dsl/camel-jbang/camel-launcher/src/main/assembly/launcher-content.xml
index f648f2f9d0ea0..296373b1c0458 100644
--- a/dsl/camel-jbang/camel-launcher/src/main/assembly/launcher-content.xml
+++ b/dsl/camel-jbang/camel-launcher/src/main/assembly/launcher-content.xml
@@ -56,6 +56,8 @@
original-*.jar
+ *-sources.jar
+ *-javadoc.jar
diff --git a/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.bat b/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.bat
index 692dbea4de267..9d485f9a39f99 100644
--- a/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.bat
+++ b/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.bat
@@ -49,9 +49,12 @@ set "JAVACMD=%CAMEL_JAVACMD%"
@REM Set JVM options if specified
if "%JAVA_OPTS%" == "" set JAVA_OPTS=-Xmx512m
-@REM Find the launcher JAR
+@REM Find the launcher JAR, excluding sources and javadoc
set "LAUNCHER_JAR="
-for %%i in ("%BASEDIR%\camel-launcher-*.jar") do set "LAUNCHER_JAR=%%i"
+for %%i in ("%BASEDIR%\camel-launcher-*.jar") do (
+ echo %%~nxi| findstr /i /e /l /c:"-sources.jar" /c:"-javadoc.jar" > nul
+ if errorlevel 1 if not defined LAUNCHER_JAR set "LAUNCHER_JAR=%%~fi"
+)
@REM Execute Camel CLI, preserving arguments and the child exit code
for %%e in ("%JAVACMD%") do set "_JAVACMD_EXT=%%~xe"
diff --git a/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.sh b/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.sh
index c5f1fb6fd0c79..36a66c77efaba 100644
--- a/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.sh
+++ b/dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.sh
@@ -100,9 +100,10 @@ then
REPO="$BASEDIR"
fi
-# Find the launcher JAR
+# Find the launcher JAR, excluding sources and javadoc
LAUNCHER_JAR=
for f in "$BASEDIR"/camel-launcher-*.jar; do
+ case "$f" in *-sources.jar|*-javadoc.jar) continue ;; esac
if [ -f "$f" ]; then
LAUNCHER_JAR="$f"
break
diff --git a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelBatDiscoveryTest.java b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelBatDiscoveryTest.java
index 4243115762756..03883353c0eb6 100644
--- a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelBatDiscoveryTest.java
+++ b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelBatDiscoveryTest.java
@@ -76,6 +76,25 @@ private Path currentJavaHome() {
return javaHome;
}
+ @Test
+ void skipsSourcesAndJavadocJars(@TempDir Path base) throws Exception {
+ Path h = home(Files.createDirectories(base.resolve("launcher with spaces")));
+ Files.writeString(h.resolve("camel-launcher-9.9.9-sources.jar"), "sources");
+ Files.writeString(h.resolve("camel-launcher-zzz-sources.jar"), "sources");
+ Files.writeString(h.resolve("camel-launcher-9.9.9-javadoc.jar"), "javadoc");
+ Files.writeString(h.resolve("camel-launcher-zzz-javadoc.jar"), "javadoc");
+ Path java = FakeJava.writeFakeJava(base, "java", JAVA17, 0, "JAVACMD");
+ Map env = isolatedEnvironment();
+ env.put("JAVACMD", java.toString());
+
+ FakeJava.Result r = FakeJava.run(h.resolve("camel.bat"), env, "hawtio");
+
+ assertEquals(0, r.exitCode(), r.stderr());
+ assertTrue(r.stdout().contains(h.resolve("camel-launcher-9.9.9.jar").toString()), r.stdout());
+ assertFalse(r.stdout().contains("-sources.jar"), r.stdout());
+ assertFalse(r.stdout().contains("-javadoc.jar"), r.stdout());
+ }
+
@Test
void acceptsJava17ViaJavacmd(@TempDir Path base) throws Exception {
Path h = home(base);
diff --git a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelShDiscoveryTest.java b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelShDiscoveryTest.java
index ad2735ed362ce..08fac4adf315d 100644
--- a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelShDiscoveryTest.java
+++ b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelShDiscoveryTest.java
@@ -56,6 +56,26 @@ private String pathWithNonqualifyingJava(Path base) throws Exception {
return pathDir + ":/usr/bin:/bin";
}
+ @Test
+ void skipsSourcesAndJavadocJars(@TempDir Path base) throws Exception {
+ Path h = home(Files.createDirectories(base.resolve("launcher with spaces")));
+ Files.writeString(h.resolve("camel-launcher-9.9.9-sources.jar"), "sources");
+ Files.writeString(h.resolve("camel-launcher-zzz-sources.jar"), "sources");
+ Files.writeString(h.resolve("camel-launcher-9.9.9-javadoc.jar"), "javadoc");
+ Files.writeString(h.resolve("camel-launcher-zzz-javadoc.jar"), "javadoc");
+ Path java = FakeJava.writeFakeJava(base, "java", JAVA17, 0, "JAVACMD");
+ Map env = new HashMap<>();
+ env.put("LC_ALL", "C");
+ env.put("JAVACMD", java.toString());
+
+ FakeJava.Result r = FakeJava.run(h.resolve("camel.sh"), env, "hawtio");
+
+ assertEquals(0, r.exitCode(), r.stderr());
+ assertTrue(r.stdout().contains(h.resolve("camel-launcher-9.9.9.jar").toString()), r.stdout());
+ assertFalse(r.stdout().contains("-sources.jar"), r.stdout());
+ assertFalse(r.stdout().contains("-javadoc.jar"), r.stdout());
+ }
+
@Test
void acceptsJava17ViaJavacmd(@TempDir Path base) throws Exception {
Path h = home(base);