Skip to content

Instantly share code, notes, and snippets.

@lucasnata
Last active April 11, 2019 12:00
Show Gist options
  • Save lucasnata/ed95ca8bbf31a7986c4e4654cc449eb7 to your computer and use it in GitHub Desktop.
Save lucasnata/ed95ca8bbf31a7986c4e4654cc449eb7 to your computer and use it in GitHub Desktop.
Local Repository for Maven

Steps to configure a local repository on Linux (Ex.: Nexus)

  1. If not exists, create a folder /home/user/.m2, and copy this settings.xml and settings-security.xml.

  2. Run the command for generate password for settings.xml:

    mvn --encrypt-password <maven-local-repo-password>

    Copy the generated hash (with {}) and paste on settings.xml (/servers/server/password)

  3. Run the command for generate password to settings-security.xml:

    mvn --encrypt-master-password <maven-local-repo-password>

    Copy the generated hash (with {}) and paste on settings-security.xml (/settingsSecurity/master)

<settingsSecurity>
<master>******</master>
</settingsSecurity>
<settings>
<servers>
<server>
<id>maven-objects</id>
<username>user</username>
<password>******</password>
</server>
<server>
<id>maven-libs</id>
<username>user</username>
<password>******</password>
</server>
</servers>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>maven-criar-objects</id>
<url>http://servername/repository/maven-objects/</url>
</repository>
<repository>
<id>maven-criar-libs</id>
<url>http://servername/repository/maven-libs/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
</settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment