Get maven user home (~/.m2) with the same logic with maven

New maven wrapper will guess the maven user home location via system props, system envs
and at last the default location (`~/.m2`).
This guessing order is the convention of the gradle wrapper.
For maven, user home has a fixed location, i.e. `~/.m2`.
This commit is contained in:
James Z.M. Gao 2020-05-25 00:26:53 +08:00 committed by rfscholte
parent fe3b2dcb8a
commit f8b556c2e8
1 changed files with 1 additions and 19 deletions

View File

@ -36,10 +36,6 @@ public class MavenWrapperMain
public static final String DEFAULT_MAVEN_USER_HOME = System.getProperty( "user.home" ) + "/.m2";
public static final String MAVEN_USER_HOME_PROPERTY_KEY = "maven.user.home";
public static final String MAVEN_USER_HOME_ENV_KEY = "MAVEN_USER_HOME";
public static final String MVNW_VERBOSE = "MVNW_VERBOSE";
public static final String MVNW_USERNAME = "MVNW_USERNAME";
@ -104,20 +100,6 @@ public class MavenWrapperMain
private static Path mavenUserHome()
{
String mavenUserHome = System.getProperty( MAVEN_USER_HOME_PROPERTY_KEY );
if ( mavenUserHome != null )
{
return Paths.get( mavenUserHome );
}
mavenUserHome = System.getenv( MAVEN_USER_HOME_ENV_KEY );
if ( mavenUserHome != null )
{
return Paths.get( mavenUserHome );
}
else
{
return Paths.get( DEFAULT_MAVEN_USER_HOME );
}
return Paths.get( DEFAULT_MAVEN_USER_HOME );
}
}