From 6fba7aa3c4d31d088df3ef682f7307b7c9a2f17c Mon Sep 17 00:00:00 2001 From: "James Z.M. Gao" Date: Sun, 24 May 2020 22:36:14 +0800 Subject: [PATCH] get MVNW_USERNAME and MVNW_PASSWORD from env when auth for the http proxy, MVNW_{USERNAME,PASSWORD} should be fetched via `System.getenv`. --- .../java/org/apache/maven/wrapper/DefaultDownloader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maven-wrapper/src/main/java/org/apache/maven/wrapper/DefaultDownloader.java b/maven-wrapper/src/main/java/org/apache/maven/wrapper/DefaultDownloader.java index 943189bfca..61957239e4 100644 --- a/maven-wrapper/src/main/java/org/apache/maven/wrapper/DefaultDownloader.java +++ b/maven-wrapper/src/main/java/org/apache/maven/wrapper/DefaultDownloader.java @@ -68,7 +68,7 @@ private void configureProxyAuthentication() private void configureAuthentication() { - if ( System.getProperty( "MVNW_USERNAME" ) != null && System.getProperty( "MVNW_PASSWORD" ) != null + if ( System.getenv( MVNW_USERNAME ) != null && System.getenv( MVNW_PASSWORD ) != null && System.getProperty( "http.proxyUser" ) == null ) { Authenticator.setDefault( new Authenticator() @@ -76,8 +76,8 @@ private void configureAuthentication() @Override protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication( System.getProperty( "MVNW_USERNAME" ), - System.getProperty( "MVNW_PASSWORD" ).toCharArray() ); + return new PasswordAuthentication( System.getenv( MVNW_USERNAME ), + System.getenv( MVNW_PASSWORD ).toCharArray() ); } } ); }