This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 77c7fb4f47b CAMEL-26534: camel-itest-spring-boot - drop -nsu from the 
nested Maven runs
77c7fb4f47b is described below

commit 77c7fb4f47be2481942ac766dae7ff6a4f19ab4e
Author: croway <[email protected]>
AuthorDate: Tue Nov 3 11:56:11 2026 +0100

    CAMEL-26534: camel-itest-spring-boot - drop -nsu from the nested Maven runs
    
    -nsu sets the Maven session update policy to never, which Maven Resolver
    applies to release repositories too. Version ranges in a starter's
    dependency tree were therefore resolved against whatever metadata the
    shared local repository cached, and CamelOpenfeatureIT failed on builds35
    once flagd 0.15.0 required flagd-core [3.0.0,4.0.0).
---
 tests/camel-itest-spring-boot/README.adoc                        | 2 +-
 .../itest/springboot/common/ArchetypeGenerationExtension.java    | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/camel-itest-spring-boot/README.adoc 
b/tests/camel-itest-spring-boot/README.adoc
index 2e9fc0f9c2b..dfccf65055f 100644
--- a/tests/camel-itest-spring-boot/README.adoc
+++ b/tests/camel-itest-spring-boot/README.adoc
@@ -7,7 +7,7 @@ Integration tests that verify each Camel Spring Boot starter 
can be compiled, st
 Each test class (e.g. `CamelActivemq6IT`) follows these steps:
 
 . **Archetype generation** -- The `ArchetypeGenerationExtension` JUnit 6 
extension generates a minimal Spring Boot project from 
`camel-archetype-spring-boot`. Because `archetype:generate` is a Maven JVM 
start per invocation, the project is generated once per build into 
`target/archetype-templates/<key>` (the key covers the archetype jar and the 
versions passed to it, concurrent forks are serialised with a file lock) and 
copied for every test. The copy is then customized: the artifactId i [...]
-. **Compilation** -- The generated project is compiled via `mvn compile 
dependency:build-classpath`, which also writes the full runtime classpath to a 
file for the next step. Both nested Maven invocations run with `-nsu` (the 
reactor build just installed every snapshot they need) and a 1 GB heap instead 
of the one in `.mvn/jvm.config`.
+. **Compilation** -- The generated project is compiled via `mvn compile 
dependency:build-classpath`, which also writes the full runtime classpath to a 
file for the next step. Both nested Maven invocations run with a 1 GB heap 
instead of the one in `.mvn/jvm.config`. They keep the default update policy 
rather than `-nsu`, which would also stop Maven from refreshing release 
metadata, so a version range in a starter's dependencies (such as the one flagd 
declares for `flagd-core`) would be r [...]
 . **Classloader isolation** -- A child `URLClassLoader` is created with the 
compiled classes and all resolved dependency JARs, parented by the test 
classloader. Only `camel-api` and `spring-context` live on the parent 
classloader so that assertion types (`CamelContext`, `Component`, `DataFormat`, 
`Language`, `CamelClusterService`) are shared.
 . **Spring Boot startup** -- `SpringApplication` is loaded from the child 
classloader and started via reflection. A `DefaultResourceLoader` pointing at 
the child classloader ensures the generated project's `application.properties` 
is picked up. By default, the embedded web server is disabled 
(`spring.main.web-application-type=none`). When `webRequired` is set to `true`, 
the web stack is kept and the server binds to a random port (`server.port=0`) 
to avoid conflicts during parallel execution.
 . **Assertions** -- Tests verify the `CamelContext` is running, 
components/dataformats/languages can be resolved, and no dependency version 
mismatches exist.
diff --git 
a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/common/ArchetypeGenerationExtension.java
 
b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/common/ArchetypeGenerationExtension.java
index 125c5a7f42a..2ee234538b6 100644
--- 
a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/common/ArchetypeGenerationExtension.java
+++ 
b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/common/ArchetypeGenerationExtension.java
@@ -203,14 +203,15 @@ public class ArchetypeGenerationExtension implements 
BeforeAllCallback, BeforeEa
     /**
      * Runs Maven in {@code workDir} and returns its output, failing with the 
output on a non-zero exit.
      * <p>
-     * The invocation is quiet, in batch mode and skips snapshot update checks 
({@code -nsu}): every snapshot
-     * the generated project needs was just installed by the reactor build, 
and the remote metadata check
-     * costs up to a second per invocation. Missing artifacts are still 
downloaded.
+     * The invocation is quiet and in batch mode. It deliberately keeps the 
default update policy instead of
+     * {@code -nsu}: that flag makes Maven never refresh any cached metadata, 
release metadata included, so a
+     * version range in a starter's dependency tree would be resolved against 
whatever the shared local
+     * repository cached before newer versions were released, and fail with 
"No versions available".
      */
     static String runMaven(Path workDir, String... args) throws IOException, 
InterruptedException {
         List<String> command = new ArrayList<>();
         command.add(resolveMavenCommand());
-        command.addAll(List.of("-q", "-B", "-nsu"));
+        command.addAll(List.of("-q", "-B"));
         command.addAll(List.of(args));
         String localRepo = System.getProperty("maven.repo.local");
         if (localRepo != null) {

Reply via email to