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/31 17:23:37 UTC

[1/6] maven git commit: [MNG-5962] mvn.cmd fails when the current directory has spaces in between [Forced Update!]

Repository: maven
Updated Branches:
  refs/heads/MNG-2199-IT 60d954499 -> 477251e04 (forced update)


[MNG-5962] mvn.cmd fails when the current directory has spaces in between


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/842b07be
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/842b07be
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/842b07be

Branch: refs/heads/MNG-2199-IT
Commit: 842b07be97fdb7d4f36e167f596eb185f9601169
Parents: 1351020
Author: Miriam Lee <mi...@gmail.com>
Authored: Thu Jan 14 13:56:36 2016 +0100
Committer: Michael Osipov <mi...@apache.org>
Committed: Mon Jan 30 13:12:57 2017 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn.cmd | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/842b07be/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index 2321b9c..467269a 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -97,29 +97,30 @@ set MAVEN_CMD_LINE_ARGS=%*
 set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
 if not "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
 
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
+set "EXEC_DIR=%CD%"
+set "WDIR=%EXEC_DIR%"
+
 :findBaseDir
 if exist "%WDIR%\.mvn" goto baseDirFound
 cd ..
 IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
+set "WDIR=%CD%"
 goto findBaseDir
 
 :baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
+set "MAVEN_PROJECTBASEDIR=%WDIR%"
 cd "%EXEC_DIR%"
 goto endDetectBaseDir
 
 :baseDirNotFound
 if "_%EXEC_DIR:~-1%"=="_\" set EXEC_DIR=%EXEC_DIR:~0,-1%
-
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+set "MAVEN_PROJECTBASEDIR=%EXEC_DIR%"
 cd "%EXEC_DIR%"
 
 :endDetectBaseDir
 
-if not exist "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+set "jvmConfig=\.mvn\jvm.config"
+if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%"  goto endReadAdditionalConfig
 
 @setlocal EnableExtensions EnableDelayedExpansion
 for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a


[6/6] maven git commit: o Updated to run the core integration tests from the MNG-2199 branch.

Posted by sc...@apache.org.
o Updated to run the core integration tests from the MNG-2199 branch.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/477251e0
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/477251e0
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/477251e0

Branch: refs/heads/MNG-2199-IT
Commit: 477251e04bef34e59f5072584d01b59dc33e6b4a
Parents: f8f483d
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jan 21 16:41:45 2017 +0100
Committer: Christian Schulte <sc...@apache.org>
Committed: Tue Jan 31 18:23:21 2017 +0100

----------------------------------------------------------------------
 Jenkinsfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/477251e0/Jenkinsfile
----------------------------------------------------------------------
diff --git a/Jenkinsfile b/Jenkinsfile
index 5b82d78..198914f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -19,7 +19,7 @@
 
 properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'10':'5'))])
 
-def itBranch='master'
+def itBranch='MNG-2199'
 
 try {
 node('ubuntu') {


[2/6] maven git commit: [MNG-5963] mvn.cmd does not return ERROR_CODE

Posted by sc...@apache.org.
[MNG-5963] mvn.cmd does not return ERROR_CODE


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/1bc69ff9
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/1bc69ff9
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/1bc69ff9

Branch: refs/heads/MNG-2199-IT
Commit: 1bc69ff93eb8bde73bf4b9872b78eb6f6be4865d
Parents: 842b07b
Author: Michael Osipov <mi...@apache.org>
Authored: Wed Feb 3 23:13:55 2016 +0100
Committer: Michael Osipov <mi...@apache.org>
Committed: Mon Jan 30 13:14:16 2017 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn.cmd | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/1bc69ff9/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index 467269a..0c2fd4b 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -46,9 +46,6 @@ if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
 
 set ERROR_CODE=0
 
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
 @REM ==== START VALIDATION ====
 if not "%JAVA_HOME%" == "" goto OkJHome
 


[4/6] maven git commit: [MNG-6003] Drastically reduce JAVA_HOME discovery code

Posted by sc...@apache.org.
[MNG-6003] Drastically reduce JAVA_HOME discovery code

All special handling has been removed. JAVA_HOME must be set properly by
the user if necessary. Error messages have been graciously borrowed from
the Tomcat start scripts.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2678388e
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2678388e
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2678388e

Branch: refs/heads/MNG-2199-IT
Commit: 2678388ea2cebc43f58009720609523ae09176f7
Parents: d426bf9
Author: Michael Osipov <mi...@apache.org>
Authored: Fri Apr 15 22:17:15 2016 +0200
Committer: Michael Osipov <mi...@apache.org>
Committed: Mon Jan 30 19:57:17 2017 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn     | 84 ++++-----------------------------------
 apache-maven/src/bin/mvn.cmd | 53 ++++++++++++------------
 2 files changed, 34 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/2678388e/apache-maven/src/bin/mvn
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index 172f43b..4db1ad6 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -41,52 +41,12 @@ fi
 
 # OS specific support. $var _must_ be set to either true or false.
 cygwin=false;
-darwin=false;
 mingw=false;
 case "`uname`" in
   CYGWIN*) cygwin=true;;
   MINGW*) mingw=true;;
-  Darwin*) darwin=true
-           #
-           # Look for the Apple JDKs first to preserve the existing behaviour, and then look
-           # for the new JDKs provided by Oracle.
-           #
-           if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
-             #
-             # Apple JDKs
-             #
-             export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
-           fi
-
-           if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
-             #
-             # Apple JDKs
-             #
-             export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
-           fi
-
-           if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
-             #
-             # Oracle JDKs
-             #
-             export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
-           fi
-
-           if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
-             #
-             # Apple JDKs
-             #
-             export JAVA_HOME=`/usr/libexec/java_home`
-           fi
-           ;;
 esac
 
-if [ -z "$JAVA_HOME" ] ; then
-  if [ -r /etc/gentoo-release ] ; then
-    JAVA_HOME=`java-config --jre-home`
-  fi
-fi
-
 ## resolve links - $0 may be a link to Maven's home
 PRG="$0"
 
@@ -129,49 +89,19 @@ if $mingw ; then
   # TODO classpath?
 fi
 
-if [ -z "$JAVA_HOME" ]; then
-  javaExecutable="`which javac`"
-  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
-    # readlink(1) is not available as standard on Solaris 10.
-    readLink=`which readlink`
-    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
-      if $darwin ; then
-        javaHome="`dirname \"$javaExecutable\"`"
-        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
-      else
-        javaExecutable="`readlink -f \"$javaExecutable\"`"
-      fi
-      javaHome="`dirname \"$javaExecutable\"`"
-      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
-      JAVA_HOME="$javaHome"
-      export JAVA_HOME
-    fi
-  fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
-  if [ -n "$JAVA_HOME"  ] ; then
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-      # IBM's JDK on AIX uses strange locations for the executables
-      JAVACMD="$JAVA_HOME/jre/sh/java"
-    else
-      JAVACMD="$JAVA_HOME/bin/java"
-    fi
-  else
-    JAVACMD="`which java`"
-  fi
+if [ -z "$JAVA_HOME" ] ; then
+  JAVACMD="`which java`"
+else
+  JAVACMD="$JAVA_HOME/bin/java"
 fi
 
 if [ ! -x "$JAVACMD" ] ; then
-  echo "Error: JAVA_HOME is not defined correctly." >&2
-  echo "  We cannot execute $JAVACMD" >&2
+  echo "The JAVA_HOME environment variable is not defined correctly" >&2
+  echo "This environment variable is needed to run this program" >&2
+  echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
   exit 1
 fi
 
-if [ -z "$JAVA_HOME" ] ; then
-  echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
 CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
 CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
 

http://git-wip-us.apache.org/repos/asf/maven/blob/2678388e/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index aab3085..ecee20c 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -30,10 +30,10 @@
 @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
 @echo off
 @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
 
 @REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPre
 @REM check for pre script, once with legacy .bat ending and once with .cmd ending
 if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat"
 if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
@@ -44,24 +44,19 @@ if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
 set ERROR_CODE=0
 
 @REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
+if not "%JAVA_HOME%"=="" goto OkJHome
+for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
+goto checkJCmd
 
 :OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
+set "JAVACMD=%JAVA_HOME%\bin\java.exe"
+
+:checkJCmd
+if exist "%JAVACMD%" goto chkMHome
+
+echo The JAVA_HOME environment variable is not defined correctly >&2
+echo This environment variable is needed to run this program >&2
+echo NB: JAVA_HOME should point to a JDK not a JRE >&2
 goto error
 
 :chkMHome
@@ -114,7 +109,7 @@ cd "%EXEC_DIR%"
 :endDetectBaseDir
 
 set "jvmConfig=\.mvn\jvm.config"
-if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%"  goto endReadAdditionalConfig
+if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%" goto endReadAdditionalConfig
 
 @setlocal EnableExtensions EnableDelayedExpansion
 for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@@ -122,13 +117,19 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
 
 :endReadAdditionalConfig
 
-set MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
 for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%%i"
-
 set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
 
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" "-Dmaven.home=%MAVEN_HOME%" "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\ext" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+"%JAVACMD%" ^
+  %JVM_CONFIG_MAVEN_PROPS% ^
+  %MAVEN_OPTS% ^
+  %MAVEN_DEBUG_OPTS% ^
+  -classpath %CLASSWORLDS_JAR% ^
+  "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
+  "-Dmaven.home=%MAVEN_HOME%" ^
+  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+  "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\ext" ^
+  %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
 if ERRORLEVEL 1 goto error
 goto end
 
@@ -138,15 +139,15 @@ set ERROR_CODE=1
 :end
 @endlocal & set ERROR_CODE=%ERROR_CODE%
 
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
 @REM check for post script, once with legacy .bat ending and once with .cmd ending
 if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
 if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
 :skipRcPost
 
 @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
 
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
 
 cmd /C exit /B %ERROR_CODE%


[5/6] maven git commit: [MNG-2199] Support version ranges in parent elements

Posted by sc...@apache.org.
[MNG-2199] Support version ranges in parent elements

o Updated to fix parent version range resolution broken since 3.2.3 and to
  remove parent version range resolution logic obsolete since Maven
  3.2.3 which changed the initialization of MavenProject instances.
o Updated local parent resolution to behave the same way remote parent
  resolution behaves. When referencing a parent using version ranges,
  inheriting the version or using version expressions should not be supported.
  It has been implemented that way for remote parent resolution as it got
  introduced in Maven 3.2.2. For local parent resolution the version in parent
  declarations had been ignored completely as of Maven 3.3.0 due to commit
  be3fb200326208ca4b8c41ebf16d5ae6b8049792 removing all local parent version
  validation. Work on fixing this is tracked by MNG-5840 released with Maven
  3.3.9. This commit adds the final missing bits to make local and remote parent
  resolution behave the same way as much as possible. As an exception, remote
  parent resolution still is a bit more strict than local parent resolution due
  to a different API in use. When resolving a parent from a repository using
  version ranges, the ModelBuilder verifies the range in use to declare an upper
  bound. When resolving a parent locally using version ranges, those ranges are
  not required to declare an upper bound because the API in use does not support
  querying that. Authoring a POM relying on this difference should be considered
  a bug.
o Added test cases to maven-core testing parent version range resolution for
  local and remote parent models.


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

Branch: refs/heads/MNG-2199-IT
Commit: f8f483d6fdb3c94f7d0463acc6c38439f36bbf55
Parents: 2678388
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Dec 12 20:28:56 2015 +0100
Committer: Christian Schulte <sc...@apache.org>
Committed: Tue Jan 31 05:47:16 2017 +0100

----------------------------------------------------------------------
 .../maven/project/DefaultProjectBuilder.java    | 111 +++++++++-------
 .../project/DefaultProjectBuildingRequest.java  |  15 ++-
 .../maven/project/ProjectBuildingRequest.java   |  14 +-
 .../project/AbstractMavenProjectTestCase.java   |  11 ++
 .../project/DefaultMavenProjectBuilderTest.java | 130 +++++++++++++++++++
 .../repository/TestRepositoryConnector.java     |  38 ++++++
 .../org/apache/apache/1/apache-1.pom            |  82 ++++++++++++
 .../org/apache/apache/maven-metadata.xml        |  13 ++
 .../pom.xml                                     |  12 ++
 .../pom.xml                                     |  11 ++
 .../parent-version-range-external-valid/pom.xml |  11 ++
 .../child/pom.xml                               |  12 ++
 .../pom.xml                                     |   7 +
 .../child/pom.xml                               |  11 ++
 .../pom.xml                                     |   7 +
 .../child/pom.xml                               |  11 ++
 .../parent-version-range-local-valid/pom.xml    |   7 +
 .../model/building/DefaultModelBuilder.java     |  25 +++-
 18 files changed, 473 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
index d064ab4..4241ac2 100644
--- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
@@ -43,7 +43,6 @@ import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.DeploymentRepository;
 import org.apache.maven.model.Extension;
 import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.ReportPlugin;
@@ -73,9 +72,6 @@ import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.repository.WorkspaceRepository;
 import org.eclipse.aether.resolution.ArtifactRequest;
 import org.eclipse.aether.resolution.ArtifactResult;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResolutionException;
-import org.eclipse.aether.resolution.VersionRangeResult;
 
 /**
  */
@@ -298,44 +294,6 @@ public class DefaultProjectBuilder
 
         boolean localProject;
 
-        if ( request.isResolveVersionRanges() )
-        {
-            VersionRangeRequest versionRangeRequest = new VersionRangeRequest( pomArtifact, config.repositories, null );
-
-            try
-            {
-                VersionRangeResult versionRangeResult =
-                    repoSystem.resolveVersionRange( config.session, versionRangeRequest );
-
-                if ( versionRangeResult.getHighestVersion() == null )
-                {
-                    throw new ProjectBuildingException(
-                        artifact.getId(), "Error resolving project artifact: No versions matched the requested range",
-                        (Throwable) null );
-
-                }
-
-                if ( versionRangeResult.getVersionConstraint() != null
-                         && versionRangeResult.getVersionConstraint().getRange() != null
-                         && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null )
-                {
-                    throw new ProjectBuildingException(
-                        artifact.getId(),
-                        "Error resolving project artifact: The requested version range does not specify an upper bound",
-                        (Throwable) null );
-
-                }
-
-                pomArtifact = pomArtifact.setVersion( versionRangeResult.getHighestVersion().toString() );
-            }
-            catch ( VersionRangeResolutionException e )
-            {
-                throw new ProjectBuildingException(
-                    artifact.getId(), "Error resolving project artifact: " + e.getMessage(), e );
-
-            }
-        }
-
         try
         {
             ArtifactRequest pomRequest = new ArtifactRequest();
@@ -656,11 +614,20 @@ public class DefaultProjectBuilder
         project.setModel( model );
         project.setOriginalModel( result.getRawModel() );
         project.setFile( model.getPomFile() );
-        Parent p = model.getParent();
-        if ( p != null )
+
+        Model parentModel = result.getModelIds().size() > 1 && !result.getModelIds().get( 1 ).isEmpty()
+                                ? result.getRawModel( result.getModelIds().get( 1 ) )
+                                : null;
+
+        if ( parentModel != null )
         {
-            project.setParentArtifact( repositorySystem.createProjectArtifact( p.getGroupId(), p.getArtifactId(),
-                                                                               p.getVersion() ) );
+            final String parentGroupId = inheritedGroupId( result, 1 );
+            final String parentVersion = inheritedVersion( result, 1 );
+
+            project.setParentArtifact( repositorySystem.createProjectArtifact( parentGroupId,
+                                                                               parentModel.getArtifactId(),
+                                                                               parentVersion ) );
+
             // org.apache.maven.its.mng4834:parent:0.1
             String parentModelId = result.getModelIds().get( 1 );
             File parentPomFile = result.getRawModel( parentModelId ).getPomFile();
@@ -683,7 +650,14 @@ public class DefaultProjectBuilder
                     catch ( ProjectBuildingException e )
                     {
                         // MNG-4488 where let invalid parents slide on by
-                        logger.warn( "Failed to build parent project for " + project.getId() );
+                        if ( logger.isDebugEnabled() )
+                        {
+                            logger.warn( "Failed to build parent project for " + project.getId(), e );
+                        }
+                        else
+                        {
+                            logger.warn( "Failed to build parent project for " + project.getId() );
+                        }
                     }
                 }
                 else
@@ -696,7 +670,14 @@ public class DefaultProjectBuilder
                     catch ( ProjectBuildingException e )
                     {
                         // MNG-4488 where let invalid parents slide on by
-                        logger.warn( "Failed to build parent project for " + project.getId() );
+                        if ( logger.isDebugEnabled() )
+                        {
+                            logger.warn( "Failed to build parent project for " + project.getId(), e );
+                        }
+                        else
+                        {
+                            logger.warn( "Failed to build parent project for " + project.getId() );
+                        }
                     }
                 }
             }
@@ -878,6 +859,40 @@ public class DefaultProjectBuilder
         }
     }
 
+    private static String inheritedGroupId( final ModelBuildingResult result, final int modelIndex )
+    {
+        String groupId = null;
+        final String modelId = result.getModelIds().get( modelIndex );
+
+        if ( !modelId.isEmpty() )
+        {
+            final Model model = result.getRawModel( modelId );
+            groupId = model.getGroupId() != null
+                          ? model.getGroupId()
+                          : inheritedGroupId( result, modelIndex + 1 );
+
+        }
+
+        return groupId;
+    }
+
+    private static String inheritedVersion( final ModelBuildingResult result, final int modelIndex )
+    {
+        String version = null;
+        final String modelId = result.getModelIds().get( modelIndex );
+
+        if ( !modelId.isEmpty() )
+        {
+            final Model model = result.getRawModel( modelId );
+            version = model.getVersion() != null
+                          ? model.getVersion()
+                          : inheritedVersion( result, modelIndex + 1 );
+
+        }
+
+        return version;
+    }
+
     private String findProfilesXml( ModelBuildingResult result, Map<File, Boolean> profilesXmls )
     {
         for ( String modelId : result.getModelIds() )

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
index f1b271b..dafbefd 100644
--- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
@@ -63,6 +63,7 @@ public class DefaultProjectBuildingRequest
 
     private boolean resolveDependencies;
 
+    @Deprecated
     private boolean resolveVersionRanges;
 
     private RepositoryMerging repositoryMerging = RepositoryMerging.POM_DOMINANT;
@@ -218,14 +219,24 @@ public class DefaultProjectBuildingRequest
         return resolveDependencies;
     }
 
-    /** @since 3.2.2 */
+    /**
+     * @since 3.2.2
+     * @deprecated This got added when implementing MNG-2199 and is no longer used.
+     * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
+     */
+    @Deprecated
     public ProjectBuildingRequest setResolveVersionRanges( boolean value )
     {
         this.resolveVersionRanges = value;
         return this;
     }
 
-    /** @since 3.2.2 */
+    /**
+     * @since 3.2.2
+     * @deprecated This got added when implementing MNG-2199 and is no longer used.
+     * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
+     */
+    @Deprecated
     public boolean isResolveVersionRanges()
     {
         return this.resolveVersionRanges;

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
index 0380278..17a53b1 100644
--- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
@@ -168,10 +168,20 @@ public interface ProjectBuildingRequest
      */
     RepositoryMerging getRepositoryMerging();
 
-    /** @since 3.2.2 */
+    /**
+     * @since 3.2.2
+     * @deprecated This got added when implementing MNG-2199 and is no longer used.
+     * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
+     */
+    @Deprecated
     boolean isResolveVersionRanges();
 
-    /** @since 3.2.2 */
+    /**
+     * @since 3.2.2
+     * @deprecated This got added when implementing MNG-2199 and is no longer used.
+     * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized.
+     */
+    @Deprecated
     ProjectBuildingRequest setResolveVersionRanges( boolean value );
 
     /**

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
----------------------------------------------------------------------
diff --git a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
index 73bdbca..71616fa 100644
--- a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
@@ -169,6 +169,17 @@ public abstract class AbstractMavenProjectTestCase
         return projectBuilder.build( pom, configuration ).getProject();
     }
 
+    protected MavenProject getProjectFromRemoteRepository( final File pom )
+        throws Exception
+    {
+        final ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
+        configuration.setLocalRepository( this.getLocalRepository() );
+        configuration.setRemoteRepositories( Arrays.asList( this.repositorySystem.createDefaultRemoteRepository() ) );
+        initRepoSession( configuration );
+
+        return projectBuilder.build( pom, configuration ).getProject();
+    }
+
     protected ProjectBuildingRequest newBuildingRequest()
         throws Exception
     {

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
----------------------------------------------------------------------
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 d61fc6e..3959cdd 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
@@ -189,4 +189,134 @@ public class DefaultMavenProjectBuilderTest
         request.setResolveDependencies( true );
         projectBuilder.build( pomFile, request );
     }
+
+    /**
+     * Tests whether local version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildValidParentVersionRangeLocally() throws Exception
+    {
+        File f1 = getTestFile( "src/test/resources/projects/parent-version-range-local-valid/child/pom.xml" );
+
+        final MavenProject childProject = getProject( f1 );
+
+        assertNotNull( childProject.getParentArtifact() );
+        assertEquals( childProject.getParentArtifact().getVersion(), "1" );
+        assertNotNull( childProject.getParent() );
+        assertEquals( childProject.getParent().getVersion(), "1" );
+        assertNotNull( childProject.getModel().getParent() );
+        assertEquals( childProject.getModel().getParent().getVersion(), "[1,10]" );
+    }
+
+    /**
+     * Tests whether local version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildParentVersionRangeLocallyWithoutChildVersion() throws Exception
+    {
+        File f1 =
+            getTestFile( "src/test/resources/projects/parent-version-range-local-child-without-version/child/pom.xml" );
+
+        try
+        {
+            getProject( f1 );
+            fail( "Expected 'ProjectBuildingException' not thrown." );
+        }
+        catch ( final ProjectBuildingException e )
+        {
+            assertNotNull( e.getMessage() );
+            assertTrue( e.getMessage().contains( "Version must be a constant" ) );
+        }
+    }
+
+    /**
+     * Tests whether local version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildParentVersionRangeLocallyWithChildVersionExpression() throws Exception
+    {
+        File f1 =
+            getTestFile(
+                "src/test/resources/projects/parent-version-range-local-child-version-expression/child/pom.xml" );
+
+        try
+        {
+            getProject( f1 );
+            fail( "Expected 'ProjectBuildingException' not thrown." );
+        }
+        catch ( final ProjectBuildingException e )
+        {
+            assertNotNull( e.getMessage() );
+            assertTrue( e.getMessage().contains( "Version must be a constant" ) );
+        }
+    }
+
+    /**
+     * Tests whether external version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildParentVersionRangeExternally() throws Exception
+    {
+        File f1 = getTestFile( "src/test/resources/projects/parent-version-range-external-valid/pom.xml" );
+
+        final MavenProject childProject = this.getProjectFromRemoteRepository( f1 );
+
+        assertNotNull( childProject.getParentArtifact() );
+        assertEquals( childProject.getParentArtifact().getVersion(), "1" );
+        assertNotNull( childProject.getParent() );
+        assertEquals( childProject.getParent().getVersion(), "1" );
+        assertNotNull( childProject.getModel().getParent() );
+        assertEquals( childProject.getModel().getParent().getVersion(), "[1,1]" );
+    }
+
+    /**
+     * Tests whether external version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildParentVersionRangeExternallyWithoutChildVersion() throws Exception
+    {
+        File f1 =
+            getTestFile(
+                "src/test/resources/projects/parent-version-range-external-child-without-version/pom.xml" );
+
+        try
+        {
+            this.getProjectFromRemoteRepository( f1 );
+            fail( "Expected 'ProjectBuildingException' not thrown." );
+        }
+        catch ( final ProjectBuildingException e )
+        {
+            assertNotNull( e.getMessage() );
+            assertTrue( e.getMessage().contains( "Version must be a constant" ) );
+        }
+    }
+
+    /**
+     * Tests whether external version range parent references are build correctly.
+     *
+     * @throws Exception
+     */
+    public void testBuildParentVersionRangeExternallyWithChildVersionExpression() throws Exception
+    {
+        File f1 =
+            getTestFile(
+                "src/test/resources/projects/parent-version-range-external-child-version-expression/pom.xml" );
+
+        try
+        {
+            this.getProjectFromRemoteRepository( f1 );
+            fail( "Expected 'ProjectBuildingException' not thrown." );
+        }
+        catch ( final ProjectBuildingException e )
+        {
+            assertNotNull( e.getMessage() );
+            assertTrue( e.getMessage().contains( "Version must be a constant" ) );
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
----------------------------------------------------------------------
diff --git a/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java b/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
index 91ace4f..cb1243c 100644
--- a/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
+++ b/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
@@ -27,6 +27,7 @@ import java.util.Collection;
 
 import org.codehaus.plexus.util.FileUtils;
 import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.spi.connector.ArtifactDownload;
 import org.eclipse.aether.spi.connector.ArtifactUpload;
@@ -35,6 +36,8 @@ import org.eclipse.aether.spi.connector.MetadataUpload;
 import org.eclipse.aether.spi.connector.RepositoryConnector;
 import org.eclipse.aether.transfer.ArtifactNotFoundException;
 import org.eclipse.aether.transfer.ArtifactTransferException;
+import org.eclipse.aether.transfer.MetadataNotFoundException;
+import org.eclipse.aether.transfer.MetadataTransferException;
 
 /**
  * @author Benjamin Bentmann
@@ -89,6 +92,28 @@ public class TestRepositoryConnector
                 }
             }
         }
+        if ( metadataDownloads != null )
+        {
+            for ( final MetadataDownload download : metadataDownloads )
+            {
+                File remoteFile = new File( basedir, path( download.getMetadata() ) );
+                try
+                {
+                    FileUtils.copyFile( remoteFile, download.getFile() );
+                }
+                catch ( IOException e )
+                {
+                    if ( !remoteFile.exists() )
+                    {
+                        download.setException( new MetadataNotFoundException( download.getMetadata(), repository ) );
+                    }
+                    else
+                    {
+                        download.setException( new MetadataTransferException( download.getMetadata(), repository, e ) );
+                    }
+                }
+            }
+        }
     }
 
     private String path( Artifact artifact )
@@ -113,6 +138,19 @@ public class TestRepositoryConnector
         return path.toString();
     }
 
+    private String path( Metadata metadata )
+    {
+        StringBuilder path = new StringBuilder( 128 );
+
+        path.append( metadata.getGroupId().replace( '.', '/' ) ).append( '/' );
+
+        path.append( metadata.getArtifactId() ).append( '/' );
+
+        path.append( "maven-metadata.xml" );
+
+        return path.toString();
+    }
+
     public void put( Collection<? extends ArtifactUpload> artifactUploads,
                      Collection<? extends MetadataUpload> metadataUploads )
     {

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/remote-repo/org/apache/apache/1/apache-1.pom
----------------------------------------------------------------------
diff --git a/maven-core/src/test/remote-repo/org/apache/apache/1/apache-1.pom b/maven-core/src/test/remote-repo/org/apache/apache/1/apache-1.pom
new file mode 100644
index 0000000..ad6b854
--- /dev/null
+++ b/maven-core/src/test/remote-repo/org/apache/apache/1/apache-1.pom
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- Shared parent. Doesn't define a lot of things about Apache like general mailing lists, but does
+       define the settings common to all projects at Apache -->
+  <groupId>org.apache</groupId>
+  <artifactId>apache</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  <name>The Apache Software Foundation</name>
+  <description>
+    The Apache Software Foundation provides support for the Apache community of open-source software projects.
+    The Apache projects are characterized by a collaborative, consensus based development process, an open and
+    pragmatic software license, and a desire to create high quality software that leads the way in its field.
+    We consider ourselves not simply a group of projects sharing a server, but rather a community of developers
+    and users.
+  </description>
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+  <url>http://www.apache.org/</url>
+  <repositories>
+    <repository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://svn.apache.org/maven-snapshot-repository</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  <distributionManagement>
+    <!-- Site omitted - each project must provide their own -->
+    <repository>
+      <id>apache.releases</id>
+      <name>Apache Release Distribution Repository</name>
+      <url>scp://minotaur.apache.org/www/www.apache.org/dist/maven-repository</url>
+    </repository>
+    <snapshotRepository>
+      <id>apache.snapshots</id>
+      <name>Apache Development Snapshot Repository</name>
+      <url>scp://minotaur.apache.org/www/cvs.apache.org/maven-snapshot-repository</url>
+    </snapshotRepository>
+  </distributionManagement>
+  <mailingLists>
+    <mailingList>
+      <name>Apache Announce List</name>
+      <subscribe>announce-subscribe@apache.org</subscribe>
+      <unsubscribe>announce-unsubscribe@apache.org</unsubscribe>
+      <post>announce@apache.org</post>
+      <archive>http://mail-archives.apache.org/mod_mbox/www-announce/</archive>
+    </mailingList>
+  </mailingLists>
+</project>
+

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/remote-repo/org/apache/apache/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/remote-repo/org/apache/apache/maven-metadata.xml b/maven-core/src/test/remote-repo/org/apache/apache/maven-metadata.xml
new file mode 100644
index 0000000..596f967
--- /dev/null
+++ b/maven-core/src/test/remote-repo/org/apache/apache/maven-metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+  <groupId>org.apache</groupId>
+  <artifactId>apache</artifactId>
+  <versioning>
+    <latest>1</latest>
+    <release>1</release>
+    <versions>
+      <version>1</version>
+    </versions>
+    <lastUpdated>20150428055824</lastUpdated>
+  </versioning>
+</metadata>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-external-child-version-expression/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-external-child-version-expression/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-external-child-version-expression/pom.xml
new file mode 100644
index 0000000..d07ad6e
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-external-child-version-expression/pom.xml
@@ -0,0 +1,12 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>[1,1]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <!-- Must not use expressions from parent due to version range. -->
+  <version>${some.property}</version>
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-external-child-without-version/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-external-child-without-version/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-external-child-without-version/pom.xml
new file mode 100644
index 0000000..4f5a004
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-external-child-without-version/pom.xml
@@ -0,0 +1,11 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>[1,1]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <!-- version>2</version Must not inherit version from parent due to version range. -->
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-external-valid/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-external-valid/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-external-valid/pom.xml
new file mode 100644
index 0000000..54eea90
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-external-valid/pom.xml
@@ -0,0 +1,11 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>[1,1]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <version>2</version>
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/child/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/child/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/child/pom.xml
new file mode 100644
index 0000000..066a11e
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/child/pom.xml
@@ -0,0 +1,12 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>parent-version-range-local</groupId>
+    <artifactId>parent</artifactId>
+    <version>[1,10]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <!-- Must not use expressions from parent due to version range. -->
+  <version>${some.property}</version>
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/pom.xml
new file mode 100644
index 0000000..a82bbf2
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-child-version-expression/pom.xml
@@ -0,0 +1,7 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>parent-version-range-local</groupId>
+	<artifactId>parent</artifactId>
+	<version>1</version>
+	<packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/child/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/child/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/child/pom.xml
new file mode 100644
index 0000000..645a8f1
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/child/pom.xml
@@ -0,0 +1,11 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>parent-version-range-local</groupId>
+    <artifactId>parent</artifactId>
+    <version>[1,10]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <!-- version>1</version Must not inherit version from parent due to version range. -->
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/pom.xml
new file mode 100644
index 0000000..a82bbf2
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-child-without-version/pom.xml
@@ -0,0 +1,7 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>parent-version-range-local</groupId>
+	<artifactId>parent</artifactId>
+	<version>1</version>
+	<packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-valid/child/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-valid/child/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-valid/child/pom.xml
new file mode 100644
index 0000000..886bcdf
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-valid/child/pom.xml
@@ -0,0 +1,11 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>parent-version-range-local</groupId>
+    <artifactId>parent</artifactId>
+    <version>[1,10]</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-core/src/test/resources/projects/parent-version-range-local-valid/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/resources/projects/parent-version-range-local-valid/pom.xml b/maven-core/src/test/resources/projects/parent-version-range-local-valid/pom.xml
new file mode 100644
index 0000000..a82bbf2
--- /dev/null
+++ b/maven-core/src/test/resources/projects/parent-version-range-local-valid/pom.xml
@@ -0,0 +1,7 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>parent-version-range-local</groupId>
+	<artifactId>parent</artifactId>
+	<version>1</version>
+	<packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/f8f483d6/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index a6a8725..49a1f3c 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -333,7 +333,7 @@ public class DefaultModelBuilder
                 currentData = superData;
             }
             else if ( currentData == resultData )
-            { // First iteration - add initial parent id after version resolution.
+            { // First iteration - add initial id after version resolution.
                 currentData.setGroupId( currentData.getRawModel().getGroupId() == null ? parentData.getGroupId()
                                                                                       : currentData.getRawModel()
                                                                                           .getGroupId() );
@@ -938,6 +938,26 @@ public class DefaultModelBuilder
                     // version skew drop back to resolution from the repository
                     return null;
                 }
+
+                // Validate versions aren't inherited when using parent ranges the same way as when read externally.
+                if ( childModel.getVersion() == null )
+                {
+                    problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                        .setMessage( "Version must be a constant" ).setLocation( childModel.getLocation( "" ) ) );
+
+                }
+                else
+                {
+                    if ( childModel.getVersion().contains( "${" ) )
+                    {
+                        problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                            .setMessage( "Version must be a constant" )
+                            .setLocation( childModel.getLocation( "version" ) ) );
+
+                    }
+                }
+
+                // MNG-2199: What else to check here ?
             }
             catch ( InvalidVersionSpecificationException e )
             {
@@ -1054,8 +1074,7 @@ public class DefaultModelBuilder
             }
             else
             {
-                if ( childModel.getVersion()
-                               .contains( "${" ) )
+                if ( childModel.getVersion().contains( "${" ) )
                 {
                     problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
                         .setMessage( "Version must be a constant" )


[3/6] maven git commit: [MNG-6001] Replace %HOME% with %USERPROFILE% in mvn.cmd

Posted by sc...@apache.org.
[MNG-6001] Replace %HOME% with %USERPROFILE% in mvn.cmd


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

Branch: refs/heads/MNG-2199-IT
Commit: d426bf9c6e59f893499c623c3434ce8f61200d9f
Parents: 1bc69ff
Author: Michael Osipov <mi...@apache.org>
Authored: Fri Apr 15 13:06:24 2016 +0200
Committer: Michael Osipov <mi...@apache.org>
Committed: Mon Jan 30 13:23:07 2017 +0100

----------------------------------------------------------------------
 apache-maven/src/bin/mvn.cmd | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/d426bf9c/apache-maven/src/bin/mvn.cmd
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index 0c2fd4b..aab3085 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -32,14 +32,11 @@
 @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
 @if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
 
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
 @REM Execute a user defined script before this one
 if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
 @REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat"
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
 :skipRcPre
 
 @setlocal
@@ -143,8 +140,8 @@ set ERROR_CODE=1
 
 if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
 @REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
 :skipRcPost
 
 @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'