MVN_REPOURL env var usage for Maven binary download

This commit is contained in:
Manfred Moser 2019-02-18 22:51:47 -08:00 committed by rfscholte
parent 9fcc635dbb
commit 98db3ffd87
3 changed files with 27 additions and 2 deletions

View File

@ -25,6 +25,13 @@ The following provides most information at an easier glance.
- see https://github.com/takari/maven-wrapper/pull/105
- fixes https://github.com/takari/maven-wrapper/issues/104
- contributed by Manfred Moser http://www.simpligility.com
- Support MVNW_REPOURL environment variable usage
- during wrapper install and wrapper usage
- for wrapper and maven distro download
- in scripts and wrapper binary
- contributed by Manfred Moser http://www.simpligility.com
Release performed by Manfred Moser - http://www.simpligility.com
## Version 0.4.2 - 2018-07-02
@ -33,6 +40,8 @@ The following provides most information at an easier glance.
- end of line in properties file
- parent pom upgrade
Release performed by Manfred Moser - http://www.simpligility.com
## Version 0.4.0 - 2018-02-19
- Allow for wrapper to work without the jar file
@ -44,6 +53,8 @@ The following provides most information at an easier glance.
- Change URLs used to official Maven repo URL
- done as part of above changes
Release performed by Manfred Moser - http://www.simpligility.com
## Version 0.3.0 - 2017-10-25
- Set title on shell window in Windows

View File

@ -32,6 +32,7 @@ import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* @author Hans Dockter
*/
@ -48,7 +49,15 @@ public class Installer {
}
public File createDist(WrapperConfiguration configuration) throws Exception {
URI distributionUrl = configuration.getDistribution();
URI distributionUrl;
String mvnwRepoUrl = System.getenv(MavenWrapperMain.MVNW_REPOURL);
if (mvnwRepoUrl != null && !mvnwRepoUrl.isEmpty()) {
distributionUrl = new URI(mvnwRepoUrl + "/" + MavenWrapperMain.MVN_PATH);
Logger.info("Detected MVNW_REPOURL environment variable " + mvnwRepoUrl);
} else {
distributionUrl = configuration.getDistribution();
}
Logger.info("Downloading Maven binary from " + distributionUrl);
boolean alwaysDownload = configuration.isAlwaysDownload();
boolean alwaysUnpack = configuration.isAlwaysUnpack();

View File

@ -38,6 +38,11 @@ public class MavenWrapperMain {
public static final String MVNW_VERBOSE = "MVNW_VERBOSE";
public static final String MVNW_USERNAME = "MVNW_USERNAME";
public static final String MVNW_PASSWORD = "MVNW_PASSWORD";
public static final String MVNW_REPOURL = "MVNW_REPOURL";
public static final String MVN_VERSION = "3.6.0";
public static final String MVN_PATH =
"org/apache/maven/apache-maven/" + MVN_VERSION + "/apache-maven-"+ MVN_VERSION + "-bin.zip";
public static void main(String[] args) throws Exception {
File wrapperJar = wrapperJar();