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

slawekjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git


The following commit(s) were added to refs/heads/master by this push:
     new b24b05c3 Fix test-scope mediation in RequireUpperBoundDeps
b24b05c3 is described below

commit b24b05c33fd23e710d28e663b83311377be6f3e2
Author: Efe Gökdemir <[email protected]>
AuthorDate: Mon Oct 26 17:28:32 2026 +0300

    Fix test-scope mediation in RequireUpperBoundDeps
---
 .../rules/dependency/RequireUpperBoundDeps.java    | 23 ++++++++-
 .../src/site/markdown/requireUpperBoundDeps.md.vm  |  2 +-
 .../menforcer1063_compile-middle-1.0.pom           | 33 ++++++++++++
 .../repository/menforcer1063_compile-root-1.0.pom  | 33 ++++++++++++
 .../it/mrm/repository/menforcer1063_shared-1.0.pom | 26 ++++++++++
 .../it/mrm/repository/menforcer1063_shared-3.0.pom | 26 ++++++++++
 .../mrm/repository/menforcer1063_test-root-1.0.pom | 33 ++++++++++++
 .../verify.groovy                                  |  2 +-
 .../invoker.properties                             | 18 +++++++
 .../pom.xml                                        | 58 ++++++++++++++++++++++
 .../invoker.properties                             | 18 +++++++
 .../pom.xml                                        | 57 +++++++++++++++++++++
 .../verify.groovy                                  | 13 +++--
 13 files changed, 331 insertions(+), 11 deletions(-)

diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/RequireUpperBoundDeps.java
 
b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/RequireUpperBoundDeps.java
index 93d43a46..971cbb77 100644
--- 
a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/RequireUpperBoundDeps.java
+++ 
b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/RequireUpperBoundDeps.java
@@ -38,6 +38,7 @@ import 
org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule;
 import org.apache.maven.enforcer.rules.utils.ArtifactUtils;
 import org.apache.maven.enforcer.rules.utils.ParentNodeProvider;
 import org.apache.maven.enforcer.rules.utils.ParentsVisitor;
+import org.eclipse.aether.graph.Dependency;
 import org.eclipse.aether.graph.DependencyNode;
 import org.eclipse.aether.graph.DependencyVisitor;
 import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
@@ -106,9 +107,14 @@ public final class RequireUpperBoundDeps extends 
AbstractStandardEnforcerRule {
 
     @Override
     public void execute() throws EnforcerRuleException {
-        DependencyNode node = 
resolverUtil.resolveTransitiveDependenciesVerbose(excludedScopes);
+        // Test-scope paths can still win mediation for a dependency also used 
by an included path.
+        List<String> scopesExcludedDuringResolution =
+                excludedScopes == null ? new ArrayList<>() : new 
ArrayList<>(excludedScopes);
+        
scopesExcludedDuringResolution.removeAll(Collections.singleton(SCOPE_TEST));
+        DependencyNode node = 
resolverUtil.resolveTransitiveDependenciesVerbose(scopesExcludedDuringResolution);
         upperBoundDepsVisitor = new RequireUpperBoundDepsVisitor()
                 .setUniqueVersions(uniqueVersions)
+                .setExcludedScopes(excludedScopes)
                 .setIncludes(includes);
         getLog().debug(() -> resolverUtil.dumpTree(node));
         node.accept(upperBoundDepsVisitor);
@@ -274,6 +280,7 @@ public final class RequireUpperBoundDeps extends 
AbstractStandardEnforcerRule {
 
         private final ParentsVisitor parentsVisitor = new ParentsVisitor();
         private boolean uniqueVersions;
+        private List<String> excludedScopes = Collections.emptyList();
         private List<String> includes = null;
 
         public RequireUpperBoundDepsVisitor setUniqueVersions(boolean 
uniqueVersions) {
@@ -281,6 +288,11 @@ public final class RequireUpperBoundDeps extends 
AbstractStandardEnforcerRule {
             return this;
         }
 
+        public RequireUpperBoundDepsVisitor setExcludedScopes(List<String> 
excludedScopes) {
+            this.excludedScopes = excludedScopes != null ? excludedScopes : 
Collections.emptyList();
+            return this;
+        }
+
         public RequireUpperBoundDepsVisitor setIncludes(List<String> includes) 
{
             this.includes = includes;
             return this;
@@ -311,7 +323,7 @@ public final class RequireUpperBoundDeps extends 
AbstractStandardEnforcerRule {
         public List<List<DependencyNode>> getConflicts() {
             List<List<DependencyNode>> output = new ArrayList<>();
             for (List<DependencyNodeHopCountPair> pairs : 
keyToPairsMap.values()) {
-                if (containsConflicts(pairs)) {
+                if (containsNonExcludedScope(pairs) && 
containsConflicts(pairs)) {
                     List<DependencyNode> outputSubList = new 
ArrayList<>(pairs.size());
                     for (DependencyNodeHopCountPair pair : pairs) {
                         outputSubList.add(pair.getNode());
@@ -322,6 +334,13 @@ public final class RequireUpperBoundDeps extends 
AbstractStandardEnforcerRule {
             return output;
         }
 
+        private boolean 
containsNonExcludedScope(List<DependencyNodeHopCountPair> pairs) {
+            return pairs.stream().anyMatch(pair -> {
+                Dependency dependency = pair.getNode().getDependency();
+                return dependency == null || 
!excludedScopes.contains(dependency.getScope());
+            });
+        }
+
         private boolean containsConflicts(List<DependencyNodeHopCountPair> 
pairs) {
             DependencyNodeHopCountPair resolvedPair = pairs.get(0);
             ArtifactVersion resolvedVersion = 
resolvedPair.extractArtifactVersion(uniqueVersions, false);
diff --git a/enforcer-rules/src/site/markdown/requireUpperBoundDeps.md.vm 
b/enforcer-rules/src/site/markdown/requireUpperBoundDeps.md.vm
index f36d34b8..081a700a 100644
--- a/enforcer-rules/src/site/markdown/requireUpperBoundDeps.md.vm
+++ b/enforcer-rules/src/site/markdown/requireUpperBoundDeps.md.vm
@@ -29,7 +29,7 @@ The following parameters are supported by this rule:
 - **uniqueVersions** - if SNAPSHOTs should be compared by their timestamped 
version or not. Default: `false`
 - **excludes** - specify the dependencies that will be ignored. The format is 
`groupId[:artifactId]`
 - **includes** - specify the dependencies that will be checked. If not empty 
only these will be checked. The format is `groupId[:artifactId]`
-- **excludedScopes** - a list of dependency scope which will be excluded. 
Default: `test`, `provided`
+- **excludedScopes** - a list of dependency scopes to exclude. A dependency is 
ignored only when all paths to it use an excluded scope. Test-scoped paths are 
still considered when the same dependency is also reached through a 
non-excluded scope, as they can affect Maven's version mediation. Other 
excluded scopes are filtered from the graph. Default: `test`, `provided`
 
 Here is a concrete example. This will cause a build to fail:
 
diff --git 
a/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-middle-1.0.pom
 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-middle-1.0.pom
new file mode 100644
index 00000000..55d19ffe
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-middle-1.0.pom
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>menforcer1063_compile-middle</artifactId>
+  <version>1.0</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_shared</artifactId>
+      <version>3.0</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-root-1.0.pom
 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-root-1.0.pom
new file mode 100644
index 00000000..49a4127e
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_compile-root-1.0.pom
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>menforcer1063_compile-root</artifactId>
+  <version>1.0</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_compile-middle</artifactId>
+      <version>1.0</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-1.0.pom 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-1.0.pom
new file mode 100644
index 00000000..b6b0de57
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-1.0.pom
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>menforcer1063_shared</artifactId>
+  <version>1.0</version>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-3.0.pom 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-3.0.pom
new file mode 100644
index 00000000..ba3520bf
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_shared-3.0.pom
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>menforcer1063_shared</artifactId>
+  <version>3.0</version>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_test-root-1.0.pom 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_test-root-1.0.pom
new file mode 100644
index 00000000..84c3a2ca
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/mrm/repository/menforcer1063_test-root-1.0.pom
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>menforcer1063_test-root</artifactId>
+  <version>1.0</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_shared</artifactId>
+      <version>1.0</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
index 1b7890c9..0b8910cc 100644
--- 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
@@ -23,4 +23,4 @@ assert buildLog.contains( 'Rule 0: 
org.apache.maven.enforcer.rules.dependency.Re
 
 assert buildLog.contains('[ERROR] Require upper bound dependencies error for 
org.apache.maven.plugins.enforcer.its:menforcer128_api:1.4.0 [provided]. Paths 
to dependency are:')
 
-assert !buildLog.contains('[ERROR] Require upper bound dependencies error for 
org.apache.maven.plugins.enforcer.its:menforcer138_utils:1.0.4')
+assert buildLog.contains('[ERROR] Require upper bound dependencies error for 
org.apache.maven.plugins.enforcer.its:menforcer138_utils:1.0.4 [test]. Paths to 
dependency are:')
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/invoker.properties
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/invoker.properties
new file mode 100644
index 00000000..2afa9966
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.buildResult=success
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/pom.xml
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/pom.xml
new file mode 100644
index 00000000..e3c47361
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-only-conflict_success/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>require-upper-bound-deps_test-only-conflict</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_shared</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_compile-root</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>enforce</id>
+            <goals><goal>enforce</goal></goals>
+            <configuration>
+              <rules><requireUpperBoundDeps/></rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/invoker.properties
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/invoker.properties
new file mode 100644
index 00000000..66b78c06
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.buildResult=failure
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/pom.xml
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/pom.xml
new file mode 100644
index 00000000..b8ed997e
--- /dev/null
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  * 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.
+  *
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+  <artifactId>require-upper-bound-deps_test-scope-mediation</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_compile-root</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer1063_test-root</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>enforce</id>
+            <goals><goal>enforce</goal></goals>
+            <configuration>
+              <rules><requireUpperBoundDeps/></rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/verify.groovy
similarity index 61%
copy from 
maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
copy to 
maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/verify.groovy
index 1b7890c9..122d9de1 100644
--- 
a/maven-enforcer-plugin/src/it/projects/require-upper-bound-dependencies-scope-change/verify.groovy
+++ 
b/maven-enforcer-plugin/src/it/projects/require-upper-bound-deps_test-scope-mediation_failure/verify.groovy
@@ -16,11 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+def buildLog = new File(basedir, 'build.log').text
 
-def buildLog = new File( basedir, 'build.log' ).text
-
-assert buildLog.contains( 'Rule 0: 
org.apache.maven.enforcer.rules.dependency.RequireUpperBoundDeps failed with 
message:' )
-
-assert buildLog.contains('[ERROR] Require upper bound dependencies error for 
org.apache.maven.plugins.enforcer.its:menforcer128_api:1.4.0 [provided]. Paths 
to dependency are:')
-
-assert !buildLog.contains('[ERROR] Require upper bound dependencies error for 
org.apache.maven.plugins.enforcer.its:menforcer138_utils:1.0.4')
+assert buildLog.contains('RequireUpperBoundDeps failed with message:')
+assert 
buildLog.contains('org.apache.maven.plugins.enforcer.its:menforcer1063_shared:1.0')
+assert 
buildLog.contains('org.apache.maven.plugins.enforcer.its:menforcer1063_shared:3.0')
+assert buildLog.contains('menforcer1063_test-root:1.0 [test]')
+assert buildLog.contains('menforcer1063_compile-middle:1.0')

Reply via email to