This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.18.x by this push:
new f3b17ae358a2 CAMEL-28072: camel-catalog - update-camel-releases reads
the old releases from the project base directory (#31296)
f3b17ae358a2 is described below
commit f3b17ae358a2ccd7fb1e3bf5ae3fae39d0cbbf4e
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Dec 2 23:02:08 2026 +0100
CAMEL-28072: camel-catalog - update-camel-releases reads the old releases
from the project base directory (#31296)
The goal read src/main/resources/.../old-camel-releases.json relative to
the working directory, so it failed when
run with -pl from the root of the repository, as the release guide and the
weekly sync-catalog-website.yml workflow
do. The old releases are now read from project.getBasedir().
Backport of #31294.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../maven/packaging/UpdateCamelReleasesMojo.java | 10 +++--
.../packaging/UpdateCamelReleasesMojoTest.java | 49 ++++++++++++++++++++++
2 files changed, 56 insertions(+), 3 deletions(-)
diff --git
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojo.java
index ca8e70c6590e..3b77590d0d1f 100644
---
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojo.java
+++
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojo.java
@@ -93,7 +93,7 @@ public class UpdateCamelReleasesMojo extends
AbstractGeneratorMojo {
JsonArray arr = new JsonArray();
if ("Camel".equals(kind)) {
// include old releases
- arr.addAll(processOldReleases());
+ arr.addAll(processOldReleases(project.getBasedir()));
}
for (ReleaseModel r : releases) {
// kind: legacy should be kind: lts
@@ -111,8 +111,12 @@ public class UpdateCamelReleasesMojo extends
AbstractGeneratorMojo {
addResourceDirectory(path);
}
- private JsonArray processOldReleases() throws Exception {
- File f = new
File("src/main/resources/org/apache/camel/catalog/releases/old-camel-releases.json");
+ /**
+ * Loads the old releases relative to the base directory of the project,
as the goal runs with -pl from the root of
+ * the repository, where the working directory is not the project.
+ */
+ static JsonArray processOldReleases(File baseDir) throws Exception {
+ File f = new File(baseDir,
"src/main/resources/org/apache/camel/catalog/releases/old-camel-releases.json");
String json = PackageHelper.loadText(f);
return Jsoner.deserialize(json, new JsonArray());
}
diff --git
a/tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojoTest.java
b/tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojoTest.java
new file mode 100644
index 000000000000..e60afafd9830
--- /dev/null
+++
b/tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateCamelReleasesMojoTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.maven.packaging;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * CAMEL-28072: the old releases are read relative to the base directory of
the project, not the working directory, so
+ * the goal works when run with -pl from the root of the repository.
+ */
+class UpdateCamelReleasesMojoTest {
+
+ @Test
+ void oldReleasesAreReadFromTheProjectBaseDir(@TempDir Path baseDir) throws
Exception {
+ Path dir =
baseDir.resolve("src/main/resources/org/apache/camel/catalog/releases");
+ Files.createDirectories(dir);
+ Files.writeString(dir.resolve("old-camel-releases.json"), """
+ [{"version": "2.0.0", "date": "2009-08-24", "kind":
"legacy"}]""");
+
+ // the working directory of the test (the plugin module) has no such
file
+
assertThat(Path.of("src/main/resources/org/apache/camel/catalog/releases/old-camel-releases.json")).doesNotExist();
+
+ JsonArray old =
UpdateCamelReleasesMojo.processOldReleases(baseDir.toFile());
+ assertThat(old).hasSize(1);
+ assertThat(((JsonObject)
old.get(0)).getString("version")).isEqualTo("2.0.0");
+ }
+}