You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/03/14 14:10:01 UTC

[maven] branch MNG-6075 updated (2ffefd6 -> 2875303)

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

michaelo pushed a change to branch MNG-6075
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard 2ffefd6  [MNG-6075] Increase the model validation level to the next minor level version
     new 2875303  [MNG-6075] Increase the model validation level to the next minor level version

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (2ffefd6)
            \
             N -- N -- N   refs/heads/MNG-6075 (2875303)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../maven/project/DefaultMavenProjectBuilderTest.java      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)


[maven] 01/01: [MNG-6075] Increase the model validation level to the next minor level version

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6075
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 287530320ce9d27f53ba03fb4e457ca4943bc56b
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Mar 14 00:07:24 2021 +0100

    [MNG-6075] Increase the model validation level to the next minor level version
    
    This closes #455
---
 .../project/DefaultMavenProjectBuilderTest.java    |  2 +
 .../maven/model/building/ModelBuildingRequest.java |  2 +-
 .../validation/DefaultModelValidatorTest.java      | 70 ++++++++--------------
 3 files changed, 29 insertions(+), 45 deletions(-)

diff --git a/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
index 2bff5d0..48c765b 100644
--- a/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
@@ -39,6 +39,7 @@ import java.util.List;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 
@@ -87,6 +88,7 @@ public class DefaultMavenProjectBuilderTest
         getProject( f2 );
     }
 
+    @Disabled( "Maven 4 does not allow duplicate plugin declarations" )
     @Test
     public void testDuplicatePluginDefinitionsMerged()
         throws Exception
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
index bbd9e8b..9cdb06c 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
@@ -62,7 +62,7 @@ public interface ModelBuildingRequest
     /**
      * Denotes strict validation as recommended by the current Maven version.
      */
-    int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
+    int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_1;
 
     /**
      * Gets the file model to build (with profile activation).
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index 5de48c4..c6f3188 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -474,21 +474,13 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validateRaw( "hard-coded-system-path.xml" );
 
-        assertViolations( result, 0, 0, 1 );
+        assertViolations( result, 0, 0, 3 );
 
         assertContains( result.getWarnings().get( 0 ),
-                        "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
-
-        SimpleProblemCollector result_31 =
-            validateRaw( "hard-coded-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
-
-        assertViolations( result_31, 0, 0, 3 );
-
-        assertContains( result_31.getWarnings().get( 0 ),
                         "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
-        assertContains( result_31.getWarnings().get( 1 ),
+        assertContains( result.getWarnings().get( 1 ),
                         "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
-        assertContains( result_31.getWarnings().get( 2 ),
+        assertContains( result.getWarnings().get( 2 ),
                         "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
 
     }
@@ -510,12 +502,12 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validateRaw( "duplicate-plugin.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertTrue( result.getWarnings().get( 0 ).contains( "duplicate declaration of plugin test:duplicate" ) );
-        assertTrue( result.getWarnings().get( 1 ).contains( "duplicate declaration of plugin test:managed-duplicate" ) );
-        assertTrue( result.getWarnings().get( 2 ).contains( "duplicate declaration of plugin profile:duplicate" ) );
-        assertTrue( result.getWarnings().get( 3 ).contains( "duplicate declaration of plugin profile:managed-duplicate" ) );
+        assertTrue( result.getErrors().get( 0 ).contains( "duplicate declaration of plugin test:duplicate" ) );
+        assertTrue( result.getErrors().get( 1 ).contains( "duplicate declaration of plugin test:managed-duplicate" ) );
+        assertTrue( result.getErrors().get( 2 ).contains( "duplicate declaration of plugin profile:duplicate" ) );
+        assertTrue( result.getErrors().get( 3 ).contains( "duplicate declaration of plugin profile:managed-duplicate" ) );
     }
 
     @Test
@@ -538,12 +530,12 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "reserved-repository-id.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'repositories.repository.id'" + " must not be 'local'" );
-        assertContains( result.getWarnings().get( 1 ), "'pluginRepositories.pluginRepository.id' must not be 'local'" );
-        assertContains( result.getWarnings().get( 2 ), "'distributionManagement.repository.id' must not be 'local'" );
-        assertContains( result.getWarnings().get( 3 ),
+        assertContains( result.getErrors().get( 0 ), "'repositories.repository.id'" + " must not be 'local'" );
+        assertContains( result.getErrors().get( 1 ), "'pluginRepositories.pluginRepository.id' must not be 'local'" );
+        assertContains( result.getErrors().get( 2 ), "'distributionManagement.repository.id' must not be 'local'" );
+        assertContains( result.getErrors().get( 3 ),
                         "'distributionManagement.snapshotRepository.id' must not be 'local'" );
     }
 
@@ -597,9 +589,9 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-version.xml" );
 
-        assertViolations( result, 0, 0, 1 );
+        assertViolations( result, 0, 1, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'version' must not contain any of these characters" );
+        assertContains( result.getErrors().get( 0 ), "'version' must not contain any of these characters" );
     }
 
     @Test
@@ -608,9 +600,9 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-snapshot-version.xml" );
 
-        assertViolations( result, 0, 0, 1 );
+        assertViolations( result, 0, 1, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'version' uses an unsupported snapshot version format" );
+        assertContains( result.getErrors().get( 0 ), "'version' uses an unsupported snapshot version format" );
     }
 
     @Test
@@ -619,15 +611,15 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-repository-id.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertContains( result.getWarnings().get( 0 ),
+        assertContains( result.getErrors().get( 0 ),
                         "'repositories.repository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 1 ),
+        assertContains( result.getErrors().get( 1 ),
                         "'pluginRepositories.pluginRepository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 2 ),
+        assertContains( result.getErrors().get( 2 ),
                         "'distributionManagement.repository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 3 ),
+        assertContains( result.getErrors().get( 3 ),
                         "'distributionManagement.snapshotRepository.id' must not contain any of these characters" );
     }
 
@@ -697,25 +689,15 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validateRaw( "basedir-system-path.xml" );
 
-        assertViolations( result, 0, 0, 2 );
+        assertViolations( result, 0, 0, 4 );
 
         assertContains( result.getWarnings().get( 0 ),
-                        "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
-        assertContains( result.getWarnings().get( 1 ),
-                        "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
-
-        SimpleProblemCollector result_31 =
-            validateRaw( "basedir-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
-
-        assertViolations( result_31, 0, 0, 4 );
-
-        assertContains( result_31.getWarnings().get( 0 ),
                         "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
-        assertContains( result_31.getWarnings().get( 1 ),
+        assertContains( result.getWarnings().get( 1 ),
                         "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
-        assertContains( result_31.getWarnings().get( 2 ),
+        assertContains( result.getWarnings().get( 2 ),
                         "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
-        assertContains( result_31.getWarnings().get( 3 ),
+        assertContains( result.getWarnings().get( 3 ),
                         "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
     }