Securing Maven Settings


references

mvn

$ which mvn
...
$ mvn --version
...
...
$

–encrypt-master-massword

$ mvn --encrypt-master-password your-master-password
{TCb..........................................................sxO}
$

~/.m2/settings-security.xml

$ cat ~/.m2/settings-security.xml
<settingsSecurity>
  <master>{TCb..........................................................sxO}</master>
</settingsSecurity>
$

–encrypt-password

$ mvn --encrypt-password your-password
{0Tr......................................GI=}
$

~/.m2/settings.xml

$ cat ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers>
    <server>
      <id>your-server</id>
      <username>your-username</username>
      <!-- encrypted your-password -->
      <password>{0Tr......................................GI=}</password>
    </server>
  </servers>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>
$

pom.xml

$ cat pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <distributionManagement>
    <repository>
      <id>your-server</id> <!-- matches ~/.m2/settings.xml:///settings/servers/server/id -->
      <url>...</url>
    </repository>
  </distributionManagement>

</project>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s