Maven Secure Proxy Setup

Prerequisite –
Maven should be installed on user’s computer.

To create secure proxy setings in maven we need to follow below steps –

1.Open CMD and type “mvn –encrypt-master-password my_master_password
Where my_master_password is your master password.

2.Now in cmd screen you will get a hash password like {genarated_master_hash_password} with brackets.

3. Navigate to “C:\Users\user_name\.m2” folder and create “settings-security.xml” blank file.

4. Now paste the master password on it like –

<settingsSecurity>  
  <master{generated_master_hash_password}</master>  
</settingsSecurity> 

5. Now in CMD type “mvn –encrypt-password” and provide your proxy user’s password here.

6. A new hash code will generate now. Like – {my_proxy_password_hash}

7.Now open “settings.xml” file on “C:\Users\user_name\.m2” folder and search for  proxies.

8.Now paste the following configuration on it –

<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>your_user_name</username>
<password>{my_proxy_password_hash}</password>
<host>your_proxy_host</host>
<port>your_proxy_port</port>
<nonProxyHosts>your_non_proxy_websites</nonProxyHosts>
</proxy>

Now we are able to setup proxy settings on maven with encrypted password.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *