luschmar commented on code in PR #51:
URL: https://github.com/apache/maven-wrapper/pull/51#discussion_r901338496


##########
maven-wrapper/src/main/java/org/apache/maven/wrapper/WrapperExecutor.java:
##########
@@ -105,6 +111,27 @@ private URI prepareDistributionUri()
         }
         else
         {
+            String mvnwRepoUrl = getEnv( MVNW_REPOURL );
+            if ( mvnwRepoUrl != null && !mvnwRepoUrl.isEmpty() )
+            {
+                Logger.info( "Detected MVNW_REPOURL environment variable " + 
mvnwRepoUrl );
+                if ( mvnwRepoUrl.endsWith( "/" ) )
+                {
+                    mvnwRepoUrl = mvnwRepoUrl.substring( 0, 
mvnwRepoUrl.length() - 1 );
+                }
+                String distributionPath = source.getPath();
+                int index = distributionPath.indexOf( "org/apache/maven" );
+                if ( index > 0 )
+                {
+                    distributionPath = "/" + distributionPath.substring( index 
);
+                }
+                else
+                {
+                    Logger.info( "distributionUrl don't contain package name " 
+ mvnwRepoUrl );

Review Comment:
   The docs don't provide this constraint about `distributionUrl`; and when the 
`distributionUrl` is a releative path, we don't check for the correct 
repository style url. As an user I was not aware the `distributionUrl` must be 
in format of repository layout. Since the maven-wrapper is a tool, I would 
recommend to warn the user of improper use, but not force the user for this 
format.
   
   Otherwise I think we should change the settings from `distibutionUrl` in 
`distributionVersion`  and use `MVNW_REPOURL` as `mvnwRepoUrl` because users 
are forced to use repositories. And we can easily guess the url with the 
version number, because `packaging`, `groupId` and `artifactId` are fix.
   
   Source for Repository Layout: 
https://cwiki.apache.org/confluence/display/MAVENOLD/Repository+Layout+-+Final



-- 
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-unsubscr...@maven.apache.org

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

Reply via email to