From 7d77f48aecfbe293a76f940af05b8a4112efd80f Mon Sep 17 00:00:00 2001 From: Geert Bevin Date: Fri, 17 Jul 2026 08:01:07 -0400 Subject: [PATCH] Order inherited BOM precedence by the standard scope order --- .../rife/bld/dependencies/DependencyScopes.java | 15 ++++++++------- src/test/java/rife/bld/dependencies/TestBom.java | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/rife/bld/dependencies/DependencyScopes.java b/src/main/java/rife/bld/dependencies/DependencyScopes.java index cadbf76..3f4dbed 100644 --- a/src/main/java/rife/bld/dependencies/DependencyScopes.java +++ b/src/main/java/rife/bld/dependencies/DependencyScopes.java @@ -77,12 +77,13 @@ public class DependencyScopes extends LinkedHashMap { * {@code runtime} and {@code test} scopes, and the {@code runtime} and * {@code provided} scope BOMs also apply to the {@code test} scope. * The BOMs are returned with the scope's own BOMs first, followed by - * the inherited ones from the more specific to the more general scope, - * for the {@code test} scope that is {@code test}, {@code runtime}, - * {@code provided}, {@code compile}. This order determines their - * precedence when several manage the same dependency: a BOM declared - * in the scope where a dependency is used takes precedence over a BOM - * that is inherited from a broader scope. + * the inherited ones in the standard scope order, for the {@code test} + * scope that is {@code test}, {@code compile}, {@code provided}, + * {@code runtime}. This order determines their precedence when several + * manage the same dependency: a BOM declared in the scope where a + * dependency is used takes precedence over a BOM that is inherited from + * another scope, and among the inherited BOMs the more fundamental + * scope wins. *

* The {@code standalone} scope only uses its own BOMs, and its BOMs * deliberately never apply to any other scope. @@ -106,7 +107,7 @@ public class DependencyScopes extends LinkedHashMap { return switch (scope) { case provided -> new Scope[]{Scope.provided, Scope.compile}; case runtime -> new Scope[]{Scope.runtime, Scope.compile}; - case test -> new Scope[]{Scope.test, Scope.runtime, Scope.provided, Scope.compile}; + case test -> new Scope[]{Scope.test, Scope.compile, Scope.provided, Scope.runtime}; default -> new Scope[]{scope}; }; } diff --git a/src/test/java/rife/bld/dependencies/TestBom.java b/src/test/java/rife/bld/dependencies/TestBom.java index 4082cc4..cc15dc1 100644 --- a/src/test/java/rife/bld/dependencies/TestBom.java +++ b/src/test/java/rife/bld/dependencies/TestBom.java @@ -526,7 +526,7 @@ public class TestBom { assertEquals(List.of(compile_bom), scopes.effectiveBoms(compile)); assertEquals(List.of(provided_bom, compile_bom), scopes.effectiveBoms(Scope.provided)); assertEquals(List.of(runtime_bom, compile_bom), scopes.effectiveBoms(Scope.runtime)); - assertEquals(List.of(test_bom, runtime_bom, provided_bom, compile_bom), scopes.effectiveBoms(Scope.test)); + assertEquals(List.of(test_bom, compile_bom, provided_bom, runtime_bom), scopes.effectiveBoms(Scope.test)); assertEquals(List.of(standalone_bom), scopes.effectiveBoms(Scope.standalone)); }