You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sc...@apache.org on 2017/01/21 15:41:18 UTC

maven-integration-testing git commit: [MNG-2199] Support version ranges in parent elements

Repository: maven-integration-testing
Updated Branches:
  refs/heads/MNG-2199 [created] 20a6125e7


[MNG-2199] Support version ranges in parent elements

o Updated the ITs to correctly detect parent resolution failures. Maven does
  not fail the build when it cannot resolve a parent but instead logs a
  warning message. The ITs never checked the log to contain the warning messages
  but instead asserted the build to fail when a parent cannot be resolved.
  The only Maven version supporting parent version ranges is Maven 3.2.2 due to
  this.
o Updated an incorrect test case for local parent resolution. Maven ignored
  the '<version>' in '<parent>' elements for local parent resolution. The core
  has been updated across various versions to eliminate any differences between
  local and remote parent resolution. When local parent resolution had been
  updated to match remote parent resolution, an existing IT started to fail
  testing incorrect behaviour. As soon as the '<parent>' is referenced using a
  version range, the '<version>' element in the project becomes mandatory and
  does no longer support using an expression any more. This has been that way
  for remote parent resolution from day one. It has never been supported to
  inherit a version from a parent when referencing that parent using a version
  range intentionally.
o Updated to account for updated error messages.


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/20a6125e
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/20a6125e
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/20a6125e

Branch: refs/heads/MNG-2199
Commit: 20a6125e7b6929d8f75ae1a232c252af8fe28cbc
Parents: 6c86dc6
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Dec 12 19:25:15 2015 +0100
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jan 21 15:49:57 2017 +0100

----------------------------------------------------------------------
 .../MavenITmng2199ParentVersionRangeTest.java   | 29 +++++++++++++++-----
 .../local-parent/module/pom.xml                 |  2 +-
 2 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/20a6125e/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
index 16ac91c..74a94a7 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
@@ -33,7 +33,9 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/valid-inclusive-upper-bound" );
+        File testDir =
+            ResourceExtractor.simpleExtractResources( getClass(),
+                                                      "/mng-2199-parent-version-range/valid-inclusive-upper-bound" );
 
         try
         {
@@ -43,6 +45,9 @@ public class MavenITmng2199ParentVersionRangeTest
 
             verifier.executeGoal( "verify" );
             verifier.verifyErrorFreeLog();
+
+            final List<String> lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
+            assertFalse( "Unxpected error message found.", indexOf( lines, ".*Failed to build parent project.*" ) >= 0 );
         }
         finally
         {
@@ -54,7 +59,9 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/valid-exclusive-upper-bound" );
+        File testDir =
+            ResourceExtractor.simpleExtractResources( getClass(),
+                                                      "/mng-2199-parent-version-range/valid-exclusive-upper-bound" );
 
         try
         {
@@ -64,6 +71,11 @@ public class MavenITmng2199ParentVersionRangeTest
 
             verifier.executeGoal( "verify" );
             verifier.verifyErrorFreeLog();
+
+            final List<String> lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
+            assertFalse( "Unxpected error message found.",
+                         indexOf( lines, ".*Failed to build parent project.*" ) >= 0 );
+
         }
         finally
         {
@@ -88,8 +100,9 @@ public class MavenITmng2199ParentVersionRangeTest
         catch ( final VerificationException e )
         {
             final List<String> lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
-            int msg = indexOf( lines, ".*The requested version range.*does not specify an upper bound.*" );
-            assertTrue( "Expected error message not found.", msg >= 0 );
+            assertTrue( "Expected error message not found.",
+                        indexOf( lines, ".*(parent)? version range.*does not specify an upper bound.*" ) >= 0 );
+
         }
         finally
         {
@@ -117,7 +130,7 @@ public class MavenITmng2199ParentVersionRangeTest
             final List<String> lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
             int msg =
                 indexOf( lines,
-                         ".*Version must be a constant @ org.apache.maven.its.mng2199:expression:\\$\\{project.parent.version\\}.*" );
+                         ".*Version must be a constant.*org.apache.maven.its.mng2199:expression.*" );
 
             assertTrue( "Expected error message not found.", msg >= 0 );
         }
@@ -147,7 +160,7 @@ public class MavenITmng2199ParentVersionRangeTest
             final List<String> lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
             int msg =
                 indexOf( lines,
-                         ".*Version must be a constant @ org.apache.maven.its.mng2199:inherited:\\[unknown-version\\].*" );
+                         ".*Version must be a constant.*org.apache.maven.its.mng2199:inherited.*" );
 
             assertTrue( "Expected error message not found.", msg >= 0 );
         }
@@ -161,7 +174,8 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/local-parent" );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
+                                                                 "/mng-2199-parent-version-range/local-parent" );
 
         try
         {
@@ -192,4 +206,5 @@ public class MavenITmng2199ParentVersionRangeTest
 
         return -1;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/20a6125e/core-it-suite/src/test/resources/mng-2199-parent-version-range/local-parent/module/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-2199-parent-version-range/local-parent/module/pom.xml b/core-it-suite/src/test/resources/mng-2199-parent-version-range/local-parent/module/pom.xml
index 85769ce..fc6931c 100644
--- a/core-it-suite/src/test/resources/mng-2199-parent-version-range/local-parent/module/pom.xml
+++ b/core-it-suite/src/test/resources/mng-2199-parent-version-range/local-parent/module/pom.xml
@@ -9,5 +9,5 @@
   </parent>
 
   <artifactId>local-parent-module</artifactId>
-
+  <version>1</version>
 </project>