You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/09 06:51:35 UTC

[GitHub] [maven-wrapper] slawekjaranowski commented on a diff in pull request #33: [MWRAPPER-61] Try to skip maven-wrapper.jar, call mvn directly from mvnw.

slawekjaranowski commented on code in PR #33:
URL: https://github.com/apache/maven-wrapper/pull/33#discussion_r867683474


##########
maven-wrapper/src/main/java/org/apache/maven/wrapper/Installer.java:
##########
@@ -70,8 +70,12 @@ public Path createDist( WrapperConfiguration configuration )
         {
             Logger.info( "Detected MVNW_REPOURL environment variable " + mvnwRepoUrl );
             String mvnPath = distributionUrl.toURL().toString();
-            mvnPath = mvnPath.substring( mvnPath.indexOf( "org/apache/maven" ) );
-            distributionUrl = new URI( mvnwRepoUrl ).resolve( "/" ).resolve( mvnPath );
+            int pathIdx =  mvnPath.indexOf( "org/apache/maven" );
+            if ( 0 <= pathIdx )
+            {
+                mvnPath = mvnPath.substring( pathIdx );
+                distributionUrl = new URI( mvnwRepoUrl ).resolve( "/" ).resolve( mvnPath );
+            }

Review Comment:
   How it is connected with new script type?
   
   `pathIdx` will be `-1` if there is no substring ....



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org