diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn index eedd3443b9..525b2efe5b 100755 --- a/apache-maven/src/bin/mvn +++ b/apache-maven/src/bin/mvn @@ -193,5 +193,7 @@ exec "$JAVACMD" \ $MAVEN_DEBUG_OPTS \ -classpath "${CLASSWORLDS_JAR}" \ "-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \ - "-Dmaven.home=${MAVEN_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + "-Dmaven.home=${MAVEN_HOME}" \ + "-Dlibrary.jansi.path=${MAVEN_HOME}/jansi-native" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${CLASSWORLDS_LAUNCHER} "$@" diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd index bfcc1b5639..ba61f801d1 100644 --- a/apache-maven/src/bin/mvn.cmd +++ b/apache-maven/src/bin/mvn.cmd @@ -181,6 +181,7 @@ set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher -classpath %CLASSWORLDS_JAR% ^ "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^ "-Dmaven.home=%MAVEN_HOME%" ^ + "-Dlibrary.jansi.path=%MAVEN_HOME%\jansi-native" ^ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS% if ERRORLEVEL 1 goto error diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 79ab45d46e..e1e58c8fc0 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -188,7 +188,6 @@ public class MavenCli { MavenCli cli = new MavenCli(); - prepareJansiNative(); MessageUtils.systemInstall(); int result = cli.doMain( new CliRequest( args, classWorld ) ); MessageUtils.systemUninstall(); @@ -196,64 +195,6 @@ public class MavenCli return result; } - /** - * temporary method while improvement reported to JAnsi+HawtJNI and integrated: - * library.jansi.path should point to lib/jansi-native and HawtJNI should be able to detect - * the platform instead of forcing the user having to point library.jansi.path to - * lib/jansi-native/[platform] - */ - private static void prepareJansiNative() - { - if ( System.getProperty( "library.jansi.path" ) == null ) - { - String mavenHome = System.getProperty( "maven.home" ); - - if ( mavenHome != null ) - { - File jansiNative = new File( mavenHome, "lib/jansi-native/" + hawtJNIgetPlatform() ); - System.setProperty( "library.jansi.path", jansiNative.getAbsolutePath() ); - } - } - } - - private static String hawtJNIgetOperatingSystem() - { - String name = System.getProperty( "os.name" ).toLowerCase().trim(); - if ( name.startsWith( "linux" ) ) - { - return "linux"; - } - if ( name.startsWith( "mac os x" ) ) - { - return "osx"; - } - if ( name.startsWith( "win" ) ) - { - return "windows"; - } - return name.replaceAll( "\\W+", "_" ); - - } - - private static String hawtJNIgetPlatform() - { - return hawtJNIgetOperatingSystem() + hawtJNIgetBitModel(); - } - - private static int hawtJNIgetBitModel() - { - String prop = System.getProperty( "sun.arch.data.model" ); - if ( prop == null ) - { - prop = System.getProperty( "com.ibm.vm.bitmode" ); - } - if ( prop != null ) - { - return Integer.parseInt( prop ); - } - return -1; // we don't know.. - } - // TODO need to externalize CliRequest public static int doMain( String[] args, ClassWorld classWorld ) {