You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/03/13 20:55:35 UTC
[maven-studies] branch maven-wrapper updated: Fix Path related
issues
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch maven-wrapper
in repository https://gitbox.apache.org/repos/asf/maven-studies.git
The following commit(s) were added to refs/heads/maven-wrapper by this push:
new 1ce84ee Fix Path related issues
1ce84ee is described below
commit 1ce84ee82c91093b9a2946af735465d7add5831c
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Mar 13 21:54:59 2020 +0100
Fix Path related issues
---
src/assembly/bin.xml | 2 +-
.../apache/maven/wrapper/BootstrapMainStarter.java | 2 +-
.../org/apache/maven/wrapper/MavenWrapperMain.java | 26 ++++++++++++----------
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml
index da8dd4e..c4de11d 100644
--- a/src/assembly/bin.xml
+++ b/src/assembly/bin.xml
@@ -24,7 +24,7 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
- <format>tar.gz</format>
+ <format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
diff --git a/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java b/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java
index 993f2df..a3bfed6 100644
--- a/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java
+++ b/src/main/java/org/apache/maven/wrapper/BootstrapMainStarter.java
@@ -41,7 +41,7 @@ public class BootstrapMainStarter
Class<?> mainClass = contextClassLoader.loadClass( "org.codehaus.plexus.classworlds.launcher.Launcher" );
System.setProperty( "maven.home", mavenHome.toAbsolutePath().toString() );
- System.setProperty( "classworlds.conf", mavenHome.resolve( "/bin/m2.conf" ).toAbsolutePath().toString() );
+ System.setProperty( "classworlds.conf", mavenHome.resolve( "bin/m2.conf" ).toAbsolutePath().toString() );
Method mainMethod = mainClass.getMethod( "main", String[].class );
mainMethod.invoke( null, new Object[] { args } );
diff --git a/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java b/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
index 572f3d1..772e2e6 100644
--- a/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
+++ b/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
@@ -24,6 +24,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.security.AccessControlException;
import java.util.Map;
import java.util.Properties;
@@ -66,10 +67,16 @@ public class MavenWrapperMain
String wrapperVersion = wrapperVersion();
Logger.info( "Apache Maven Wrapper " + wrapperVersion );
- Properties systemProperties = System.getProperties();
- systemProperties.putAll( parseSystemPropertiesFromArgs( args ) );
-
- addSystemProperties( rootDir );
+ try
+ {
+ Properties systemProperties = System.getProperties();
+ systemProperties.putAll( parseSystemPropertiesFromArgs( args ) );
+ addSystemProperties( rootDir );
+ }
+ catch ( AccessControlException e )
+ {
+ // no problem, just missing: permission java.util.PropertyPermission "*", "read,write";
+ }
WrapperExecutor wrapperExecutor = WrapperExecutor.forWrapperPropertiesFile( propertiesFile, System.out );
wrapperExecutor.execute( args, new Installer( new DefaultDownloader( "mvnw", wrapperVersion ),
@@ -107,21 +114,16 @@ public class MavenWrapperMain
private static Path wrapperJar()
{
- URI location;
try
{
- location = MavenWrapperMain.class.getProtectionDomain().getCodeSource().getLocation().toURI();
+ URI location = MavenWrapperMain.class.getProtectionDomain().getCodeSource().getLocation().toURI();
+
+ return Paths.get( location );
}
catch ( URISyntaxException e )
{
throw new RuntimeException( e );
}
- if ( !location.getScheme().equals( "file" ) )
- {
- throw new RuntimeException( String.format( "Cannot determine classpath for wrapper Jar from codebase '%s'.",
- location ) );
- }
- return Paths.get( location.getPath() );
}
static String wrapperVersion()