[01/49] maven git commit: [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom [Forced Update!]
Repository: maven Updated Branches: refs/heads/MNG-6255 c24ddf969 -> b918b0b12 (forced update) [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/8f8c45c9 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8f8c45c9 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8f8c45c9 Branch: refs/heads/MNG-6255 Commit: 8f8c45c990193b04c1770997d446951c5185b164 Parents: b100257 Author: Karl Heinz Marbaise Authored: Tue Apr 4 22:46:11 2017 +0200 Committer: Karl Heinz Marbaise Committed: Tue Aug 1 22:01:36 2017 +0200 -- .../model/validation/DefaultModelValidator.java | 54 ++-- .../validation/DefaultModelValidatorTest.java | 13 + .../validation/raw-model/self-referencing.xml | 38 ++ 3 files changed, 102 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven/blob/8f8c45c9/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java -- diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 2e7985f..d97d8f6 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -131,6 +131,9 @@ public class DefaultModelValidator validate20RawDependencies( problems, m.getDependencies(), "dependencies.dependency", request ); +validate20RawDependenciesSelfReferencing( problems, m, m.getDependencies(), "dependencies.dependency", + request ); + if ( m.getDependencyManagement() != null ) { validate20RawDependencies( problems, m.getDependencyManagement().getDependencies(), @@ -344,12 +347,12 @@ public class DefaultModelValidator Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); -validateEffectiveDependencies( problems, m.getDependencies(), false, request ); +validateEffectiveDependencies( problems, m, m.getDependencies(), false, request ); DependencyManagement mgmt = m.getDependencyManagement(); if ( mgmt != null ) { -validateEffectiveDependencies( problems, mgmt.getDependencies(), true, request ); +validateEffectiveDependencies( problems, m, mgmt.getDependencies(), true, request ); } if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ) @@ -524,7 +527,33 @@ public class DefaultModelValidator } } -private void validateEffectiveDependencies( ModelProblemCollector problems, List dependencies, +private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems, Model m, + List dependencies, String prefix, + ModelBuildingRequest request ) +{ +// We only check for groupId/artifactId cause if there is another +// module with the same groupId/artifactId this will fail the build +// earlier like "Project '...' is duplicated in the reactor. +// So it is sufficient to check only groupId/artifactId and not the +// packaging type. +for ( Dependency dependency : dependencies ) +{ +String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); +String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); +if ( key.equals( mKey ) ) +{ +// This means a module which is build has a dependency which has the same +// groupId, artifactId and version coordinates. This is in consequence +// a self reference or in other words a circular reference which can not +// being resolved. +addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", + dependency ); + +} +} +} + +private void validateEffectiveDependencies( ModelProblemCollector problems, Model m, List dependencies, boolean management, ModelBuildingRequest request ) { Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL
[1/2] maven git commit: [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom [Forced Update!]
Repository: maven Updated Branches: refs/heads/mvn-3.5.1/MNG-6174 049155b3d -> 4f2a2dba8 (forced update) [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/8f8c45c9 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8f8c45c9 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8f8c45c9 Branch: refs/heads/mvn-3.5.1/MNG-6174 Commit: 8f8c45c990193b04c1770997d446951c5185b164 Parents: b100257 Author: Karl Heinz Marbaise Authored: Tue Apr 4 22:46:11 2017 +0200 Committer: Karl Heinz Marbaise Committed: Tue Aug 1 22:01:36 2017 +0200 -- .../model/validation/DefaultModelValidator.java | 54 ++-- .../validation/DefaultModelValidatorTest.java | 13 + .../validation/raw-model/self-referencing.xml | 38 ++ 3 files changed, 102 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven/blob/8f8c45c9/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java -- diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 2e7985f..d97d8f6 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -131,6 +131,9 @@ public class DefaultModelValidator validate20RawDependencies( problems, m.getDependencies(), "dependencies.dependency", request ); +validate20RawDependenciesSelfReferencing( problems, m, m.getDependencies(), "dependencies.dependency", + request ); + if ( m.getDependencyManagement() != null ) { validate20RawDependencies( problems, m.getDependencyManagement().getDependencies(), @@ -344,12 +347,12 @@ public class DefaultModelValidator Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); -validateEffectiveDependencies( problems, m.getDependencies(), false, request ); +validateEffectiveDependencies( problems, m, m.getDependencies(), false, request ); DependencyManagement mgmt = m.getDependencyManagement(); if ( mgmt != null ) { -validateEffectiveDependencies( problems, mgmt.getDependencies(), true, request ); +validateEffectiveDependencies( problems, m, mgmt.getDependencies(), true, request ); } if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ) @@ -524,7 +527,33 @@ public class DefaultModelValidator } } -private void validateEffectiveDependencies( ModelProblemCollector problems, List dependencies, +private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems, Model m, + List dependencies, String prefix, + ModelBuildingRequest request ) +{ +// We only check for groupId/artifactId cause if there is another +// module with the same groupId/artifactId this will fail the build +// earlier like "Project '...' is duplicated in the reactor. +// So it is sufficient to check only groupId/artifactId and not the +// packaging type. +for ( Dependency dependency : dependencies ) +{ +String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); +String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); +if ( key.equals( mKey ) ) +{ +// This means a module which is build has a dependency which has the same +// groupId, artifactId and version coordinates. This is in consequence +// a self reference or in other words a circular reference which can not +// being resolved. +addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", + dependency ); + +} +} +} + +private void validateEffectiveDependencies( ModelProblemCollector problems, Model m, List dependencies, boolean management, ModelBuildingRequest request ) { Severity errOn30 = getSeverity( request, ModelBuildingRequ
maven git commit: [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom [Forced Update!]
Repository: maven Updated Branches: refs/heads/MNG-6123-detect-self-references 65bb30301 -> 8f8c45c99 (forced update) [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/8f8c45c9 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8f8c45c9 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8f8c45c9 Branch: refs/heads/MNG-6123-detect-self-references Commit: 8f8c45c990193b04c1770997d446951c5185b164 Parents: b100257 Author: Karl Heinz Marbaise Authored: Tue Apr 4 22:46:11 2017 +0200 Committer: Karl Heinz Marbaise Committed: Tue Aug 1 22:01:36 2017 +0200 -- .../model/validation/DefaultModelValidator.java | 54 ++-- .../validation/DefaultModelValidatorTest.java | 13 + .../validation/raw-model/self-referencing.xml | 38 ++ 3 files changed, 102 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven/blob/8f8c45c9/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java -- diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 2e7985f..d97d8f6 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -131,6 +131,9 @@ public class DefaultModelValidator validate20RawDependencies( problems, m.getDependencies(), "dependencies.dependency", request ); +validate20RawDependenciesSelfReferencing( problems, m, m.getDependencies(), "dependencies.dependency", + request ); + if ( m.getDependencyManagement() != null ) { validate20RawDependencies( problems, m.getDependencyManagement().getDependencies(), @@ -344,12 +347,12 @@ public class DefaultModelValidator Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); -validateEffectiveDependencies( problems, m.getDependencies(), false, request ); +validateEffectiveDependencies( problems, m, m.getDependencies(), false, request ); DependencyManagement mgmt = m.getDependencyManagement(); if ( mgmt != null ) { -validateEffectiveDependencies( problems, mgmt.getDependencies(), true, request ); +validateEffectiveDependencies( problems, m, mgmt.getDependencies(), true, request ); } if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ) @@ -524,7 +527,33 @@ public class DefaultModelValidator } } -private void validateEffectiveDependencies( ModelProblemCollector problems, List dependencies, +private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems, Model m, + List dependencies, String prefix, + ModelBuildingRequest request ) +{ +// We only check for groupId/artifactId cause if there is another +// module with the same groupId/artifactId this will fail the build +// earlier like "Project '...' is duplicated in the reactor. +// So it is sufficient to check only groupId/artifactId and not the +// packaging type. +for ( Dependency dependency : dependencies ) +{ +String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); +String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); +if ( key.equals( mKey ) ) +{ +// This means a module which is build has a dependency which has the same +// groupId, artifactId and version coordinates. This is in consequence +// a self reference or in other words a circular reference which can not +// being resolved. +addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", + dependency ); + +} +} +} + +private void validateEffectiveDependencies( ModelProblemCollector problems, Model m, List dependencies, boolean management, ModelBuildingRequest request ) { Severity errOn30 = getSeverity(
maven git commit: [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom [Forced Update!]
Repository: maven Updated Branches: refs/heads/MNG-6123-detect-self-references 5c4acf148 -> 4992690ed (forced update) [MNG-6123] detect self references in POM and fail fast o Added unit test and self referencing pom Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4992690e Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4992690e Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4992690e Branch: refs/heads/MNG-6123-detect-self-references Commit: 4992690ede274f9acb4e4d6f75cf3bf1481d8f40 Parents: 08f3c76 Author: Karl Heinz Marbaise Authored: Tue Apr 4 22:46:11 2017 +0200 Committer: Karl Heinz Marbaise Committed: Wed Apr 12 00:29:59 2017 +0200 -- .../model/validation/DefaultModelValidator.java | 49 ++-- .../validation/DefaultModelValidatorTest.java | 12 + .../validation/raw-model/self-referencing.xml | 38 +++ 3 files changed, 96 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven/blob/4992690e/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java -- diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index e790f21..9af8096 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -131,6 +131,9 @@ public class DefaultModelValidator validate20RawDependencies( problems, m.getDependencies(), "dependencies.dependency", request ); +validate20RawDependenciesSelfReferencing( problems, m, m.getDependencies(), "dependencies.dependency", + request ); + if ( m.getDependencyManagement() != null ) { validate20RawDependencies( problems, m.getDependencyManagement().getDependencies(), @@ -344,12 +347,12 @@ public class DefaultModelValidator Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); -validateEffectiveDependencies( problems, m.getDependencies(), false, request ); +validateEffectiveDependencies( problems, m, m.getDependencies(), false, request ); DependencyManagement mgmt = m.getDependencyManagement(); if ( mgmt != null ) { -validateEffectiveDependencies( problems, mgmt.getDependencies(), true, request ); +validateEffectiveDependencies( problems, m, mgmt.getDependencies(), true, request ); } if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ) @@ -511,7 +514,28 @@ public class DefaultModelValidator } } -private void validateEffectiveDependencies( ModelProblemCollector problems, List dependencies, +private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems, Model m, + List dependencies, String prefix, + ModelBuildingRequest request ) +{ +for ( Dependency dependency : dependencies ) +{ +String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); +String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); +if ( key.equals( mKey ) ) +{ +// This means a module which is build has a dependency which has the same +// groupId, artifactId and version coordinates. This is in consequence +// a self reference or in other words a circular reference which can not +// being resolved. +addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", + dependency ); + +} +} +} + +private void validateEffectiveDependencies( ModelProblemCollector problems, Model m, List dependencies, boolean management, ModelBuildingRequest request ) { Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); @@ -538,11 +562,30 @@ public class DefaultModelValidator */ validateEnum( prefix + "scope", problems, Severity.WARNING, Version.V20, d.getScope(), d.getManagementKey(), d, "provided", "c