This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 105e99188fde camel-launcher: skip sources and javadoc jars (#27826)
105e99188fde is described below
commit 105e99188fde6f716563ef97ce5adc3a8785a182
Author: Federico Mariani <[email protected]>
AuthorDate: Thu Oct 15 08:39:48 2026 +0200
camel-launcher: skip sources and javadoc jars (#27826)
---
.github/workflows/package-native-validation.yml | 32 +++++++++++++++-------
.../src/main/assembly/launcher-content.xml | 2 ++
.../src/main/resources/bin/camel.bat | 7 +++--
.../camel-launcher/src/main/resources/bin/camel.sh | 3 +-
.../dsl/jbang/launcher/CamelBatDiscoveryTest.java | 19 +++++++++++++
.../dsl/jbang/launcher/CamelShDiscoveryTest.java | 20 ++++++++++++++
6 files changed, 70 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/package-native-validation.yml
b/.github/workflows/package-native-validation.yml
index e631457eb961..e75c648c7ffe 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 f648f2f9d0ea..296373b1c045 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 @@
</includes>
<excludes>
<exclude>original-*.jar</exclude>
+ <exclude>*-sources.jar</exclude>
+ <exclude>*-javadoc.jar</exclude>
</excludes>
</fileSet>
<fileSet>
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 692dbea4de26..9d485f9a39f9 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 c5f1fb6fd0c7..36a66c77efab 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 424311576275..03883353c0eb 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 @@ class CamelBatDiscoveryTest {
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<String, String> 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 ad2735ed362c..08fac4adf315 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 @@ class CamelShDiscoveryTest {
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<String, String> 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);