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/05/24 15:48:53 UTC

[maven] 01/01: get MVNW_USERNAME and MVNW_PASSWORD from env

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MNG-6918
in repository https://gitbox.apache.org/repos/asf/maven.git

commit fe3b2dcb8ac2a84993cf193c576a49891e883a7e
Author: James Z.M. Gao <ga...@360.cn>
AuthorDate: Sun May 24 22:36:14 2020 +0800

    get MVNW_USERNAME and MVNW_PASSWORD from env
    
    when auth for the http proxy, MVNW_{USERNAME,PASSWORD} should be fetched via `System.getenv`.
---
 .../src/main/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 943189b..6195723 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 @@ public class DefaultDownloader
 
     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 @@ public class DefaultDownloader
                 @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() );
                 }
             } );
         }