Friday, August 9, 2013

Confiture Proxy for Maven

Configure proxy for Maven

Generate encrypted master password, and put it in ~/.m2/settings-security.xml
# mvn --encrypt-master-password think4me
{OtIRlSHHxfcHK+Udwxf3m8kVgit3Eqtztqy2ObbsZ/U=}

# cat settings-security.xml
<settingsSecurity>
  <master>{zvjuoGQr1jkHdkuZFFoQP1cmTyihJTPbKXsX5f1uCfc=}</master>
</settingsSecurity>

# mvn --encrypt-password proxyPassword
{sCFw33fLXuAHU4q3SPKxr4SOhztESnlpNnDmPT6Mk9s=}

Put the encrypted password in ~/.m2/settings.xml

# cat settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>

  <proxies>
    <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyclient</username>
      <password>{sCFw33fLXuAHU4q3SPKxr4SOhztESnlpNnDmPT6Mk9s=}</password>
      <port>8888</port>
      <host>proxy.goweekend.ca</host>
      <nonProxyHosts/>
      <id>myproxy</id>
    </proxy>
  </proxies>
</settings>

test proxy
Create application
# mvn archetype:generate -DgroupId=com.goweekend.helloworld -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

1 comment:

  1. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating Hadoop Administration Online course Bangalore

    ReplyDelete