[java-mvn-enforcer] branch main updated: JMVN-88 [ERROR] Project parent contributes compile dependencies

Codeberg noreply at shibboleth.net
Sun Oct 4 14:06:16 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-mvn-enforcer.

View the commit online:
https://codeberg.org/Shibboleth/java-mvn-enforcer/commit/ce218d067dfb2decf3a39c653e0ffaa91a389277

The following commit(s) were added to refs/heads/main by this push:
     new ce218d0  JMVN-88 [ERROR] Project parent contributes compile dependencies
ce218d0 is described below

commit ce218d067dfb2decf3a39c653e0ffaa91a389277
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Oct 4 15:05:27 2026 +0100

    JMVN-88 [ERROR] Project parent contributes compile dependencies
    
    https://shibboleth.atlassian.net/browse/JMVN-88
    
    Clean up reporting of errors but make them fatal errors fatal
---
 .../net/shibboleth/mvn/enforcer/impl/JarEnforcer.java   |  8 ++++++--
 .../shibboleth/mvn/enforcer/impl/ProjectPomContext.java | 17 ++++++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
index 359af5c..47ac73d 100644
--- a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
+++ b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
@@ -236,7 +236,10 @@ public class JarEnforcer extends AbstractEnforcerRule implements MavenLoader{
                                           StringSupport.stringToList(versionExtensions, XMLConstants.LIST_DELIMITERS),
                                           StringSupport.stringToList(classifiers, XMLConstants.LIST_DELIMITERS))) {
 
-                pomContext.initialize(pom);
+                if (!pomContext.initialize(pom)) {
+                    throw new EnforcerRuleException(
+                            "Pom tree parsing failed");
+                }
 
                 final boolean m2Result = performM2Check(pomContext);
                 final boolean depdendencyResult = performDependencyCheck(pomContext, tgzPaths, zipPaths);
@@ -263,7 +266,8 @@ public class JarEnforcer extends AbstractEnforcerRule implements MavenLoader{
     }
     // CheckStyle: CyclomaticComplexity ON
 
-    /** Grab a ClassLoader for the data file.  Eventually this will do a GPG test.
+    /** Grab a ClassLoader for the data file.  This does a GPG test on the enforcer data
++     * file before it creates the classloader (so we know that we are testing with tested data)
      * @return A class loader built from the downloaded artifact
      * @throws Exception upon an error
      */
diff --git a/src/main/java/net/shibboleth/mvn/enforcer/impl/ProjectPomContext.java b/src/main/java/net/shibboleth/mvn/enforcer/impl/ProjectPomContext.java
index d5a9e51..becb379 100644
--- a/src/main/java/net/shibboleth/mvn/enforcer/impl/ProjectPomContext.java
+++ b/src/main/java/net/shibboleth/mvn/enforcer/impl/ProjectPomContext.java
@@ -207,13 +207,16 @@ public final class ProjectPomContext implements AutoCloseable {
             return false;
         }
         isSnapShot = parentPom.getOurInfo().getVersion().endsWith("-SNAPSHOT");
-        if (!projectParent.getCompileDependencies().isEmpty()) {
-            log.error("Project parent contributes compile dependencies");
-            return false;
-        }
-        if (!projectParent.getRuntimeDependencies().isEmpty()) {
-            log.error("Project parent contributes run time dependencies");
-            return false;
+        // JMVN-45 did we get the real parent?
+        if (projectParent.getParent() == null) {
+            if (!projectParent.getCompileDependencies().isEmpty()) {
+                log.error("Project parent contributes compile dependencies");
+                return false;
+            }
+            if (!projectParent.getRuntimeDependencies().isEmpty()) {
+                log.error("Project parent contributes run time dependencies");
+                return false;
+            }
         }
         return true;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list