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

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

commit 7e2aa28a37c49a6e06f3018cf872cc7dddb09251
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Thu Nov 5 02:06:15 2026 +0000

    Cover the plugins form of requireSameVersions and keep MENFORCER-395
    
    A project with a snapshot dependency fails an includes-only 
requireReleaseDeps, so always-pass cannot host that case; the NPE guard needs a 
project without one.
---
 .../src/it/projects/MENFORCER-395/pom.xml          | 60 ++++++++++++++++++++++
 .../src/it/projects/always-pass/pom.xml            |  6 +++
 .../src/it/projects/always-pass/verify.groovy      |  1 +
 3 files changed, 67 insertions(+)

diff --git a/maven-enforcer-plugin/src/it/projects/MENFORCER-395/pom.xml 
b/maven-enforcer-plugin/src/it/projects/MENFORCER-395/pom.xml
new file mode 100644
index 00000000..54edc983
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/MENFORCER-395/pom.xml
@@ -0,0 +1,60 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>minimal-test</artifactId>
+  <version>0.0.1</version>
+  <packaging>jar</packaging>
+  <description>Minimal test for NPE in 
maven-enforcer-plugin:3.0.0</description>
+  <properties>
+    <java.source>1.8</java.source>
+    <java.target>1.8</java.target>
+  </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>enforce-no-snapshots</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireReleaseDeps>
+                  <includes>
+                    <include>testgroup:testartifact</include>
+                  </includes>
+                </requireReleaseDeps>
+              </rules>
+              <fail>true</fail>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/always-pass/pom.xml 
b/maven-enforcer-plugin/src/it/projects/always-pass/pom.xml
index 16c0e33c..fe418b8b 100644
--- a/maven-enforcer-plugin/src/it/projects/always-pass/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/always-pass/pom.xml
@@ -215,6 +215,12 @@ under the License.
                   </includes>
                 </requireReleaseDeps>
                 <requireReleaseVersion/>
+                <requireSameVersions>
+                  <plugins>
+                    
<plugin>org.apache.maven.plugins:maven-surefire-plugin</plugin>
+                    
<plugin>org.apache.maven.plugins:maven-failsafe-plugin</plugin>
+                  </plugins>
+                </requireSameVersions>
                 <requireSameVersions>
                   <buildPlugins>
                     
<buildPlugin>org.apache.maven.plugins:maven-surefire-plugin</buildPlugin>
diff --git a/maven-enforcer-plugin/src/it/projects/always-pass/verify.groovy 
b/maven-enforcer-plugin/src/it/projects/always-pass/verify.groovy
index 7f771716..90fff02f 100644
--- a/maven-enforcer-plugin/src/it/projects/always-pass/verify.groovy
+++ b/maven-enforcer-plugin/src/it/projects/always-pass/verify.groovy
@@ -49,6 +49,7 @@ def expectedRules = [
     'org.apache.maven.enforcer.rules.RequireReleaseVersion',
     'org.apache.maven.enforcer.rules.RequireSameVersions',
     'org.apache.maven.enforcer.rules.RequireSameVersions',
+    'org.apache.maven.enforcer.rules.RequireSameVersions',
     'org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum',
     'org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum',
     'org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum',

Reply via email to