You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ap...@apache.org on 2025/10/09 13:48:23 UTC
(camel) branch main updated: Fix list of Spring Boot version from Camel JBang for Camel 4.15+
This is an automated email from the ASF dual-hosted git repository.
apupier 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 3e4c05370597 Fix list of Spring Boot version from Camel JBang for Camel 4.15+
3e4c05370597 is described below
commit 3e4c0537059761f778fe563fc3f77117d1246310
Author: Aurélien Pupier <ap...@ibm.com>
AuthorDate: Thu Oct 9 15:07:15 2025 +0200
Fix list of Spring Boot version from Camel JBang for Camel 4.15+
with https://github.com/apache/camel-spring-boot/commit/71d09c68912f21c301519bbf0cfb9a325163ec10
the place to look for has been modified. This new place is in an
artifact (camel-parent) which has no jar artifact which then require to
improve the MavenDownloader.
Signed-off-by: Aurélien Pupier <ap...@ibm.com>
---
.../core/commands/version/VersionListTest.java | 58 ++++++++++++++++++++++
.../main/download/MavenDependencyDownloader.java | 7 ++-
.../org/apache/camel/tooling/maven/MavenGav.java | 13 ++++-
3 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/version/VersionListTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/version/VersionListTest.java
new file mode 100644
index 000000000000..de1d0884aba5
--- /dev/null
+++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/version/VersionListTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.dsl.jbang.core.commands.version;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelCommandBaseTest;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.common.RuntimeType;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class VersionListTest extends CamelCommandBaseTest {
+
+ @Test
+ void springbootVersionIsAvailable() throws Exception {
+ VersionList versionList = new VersionList(new CamelJBangMain().withPrinter(printer));
+ versionList.sort = "version";
+ versionList.runtime = RuntimeType.springBoot;
+
+ versionList.doCall();
+
+ List<String> lines = printer.getLines();
+ // there was a change where the information is stored in 4.15, thus the test on 4.14.1 and 4.15.0
+ Assertions.assertThat(lines.stream().collect(Collectors.joining("\n")))
+ .contains("4.14.1 3.5.6 17,21 LTS")
+ .contains("4.15.0 3.5.6 17,21");
+ }
+
+ @Test
+ void quarkusVersionIsAvailable() throws Exception {
+ VersionList versionList = new VersionList(new CamelJBangMain().withPrinter(printer));
+ versionList.sort = "version";
+ versionList.runtime = RuntimeType.quarkus;
+
+ versionList.doCall();
+
+ List<String> lines = printer.getLines();
+ Assertions.assertThat(lines.stream().collect(Collectors.joining("\n")))
+ .contains("4.14.0 3.27.0 17,21 LTS");
+ }
+
+}
diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
index e64c6ae07dc3..338f31fed69b 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
@@ -632,7 +632,12 @@ public class MavenDependencyDownloader extends ServiceSupport implements Depende
private String resolveSpringBootVersionByCamelVersion(String camelVersion, Set<String> extraRepos)
throws Exception {
- String gav = "org.apache.camel.springboot" + ":" + "spring-boot" + ":pom:" + camelVersion;
+ String gav;
+ if (VersionHelper.isGE(camelVersion, "4.15.0")) {
+ gav = "org.apache.camel:camel-parent:pom:" + camelVersion;
+ } else {
+ gav = "org.apache.camel.springboot:spring-boot:pom:" + camelVersion;
+ }
List<MavenArtifact> artifacts = resolveDependenciesViaAether(List.of(gav), extraRepos, false, false);
if (!artifacts.isEmpty()) {
diff --git a/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenGav.java b/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenGav.java
index 2882abba4a68..26d8268fea16 100644
--- a/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenGav.java
+++ b/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenGav.java
@@ -97,7 +97,18 @@ public final class MavenGav {
answer.setArtifactId(parts[1]);
}
if (parts.length > 2) {
- answer.setVersion(parts[2]);
+ String thirdpart = parts[2];
+ // here it handles a single specific case, would be better to handle all packaging types
+ if ("pom".equals(thirdpart)) {
+ answer.setPackaging("pom");
+ if (parts.length > 3) {
+ answer.setVersion(parts[3]);
+ } else if (defaultVersion != null) {
+ answer.setVersion(defaultVersion);
+ }
+ } else {
+ answer.setVersion(parts[2]);
+ }
} else if (defaultVersion != null) {
answer.setVersion(defaultVersion);
}