You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

How to configure Maven setting.xml and pom.xml to deploy a snapshot

PREREQUISITES

${renderedContent}
  • Requested and received confirmation that a private Nexus repository has been created.

    When you receive confirmaiton that the private repository has been created, you will given the following information:

    ${renderedContent}

    You will need the above information to configure your Maven project so that it can access your snapshot repository.

These instuctions assume the following:

  • The name of the Nexus Repository server is maven.mit.edu.  The actual server name may be different.

Overview

Configuring a Maven project to access a snapshot repository requires setting up a name/password pair in the settings.xml file and associating the name/password with a specific distributionManagement repository which is defined in the project's pom.xml.

Items 1 and 2 below give the syntax of the entries for both the settings.xml and pom.xml files.  It is important to note the following:

  1. The <id> element that is used in both the setting.xml (found in the <server> element) and the pom.xml (found in the <repository> element) is what associates the name/password pair with the private repository.  The <id> element in both places must be identical.  It can be anything you want it to be, the only restriction is that they must be identical.

  2. In the settings.xml, the <password> element must be the Team list name that was given to you when you received your repository confirmation.  Refer to the PREREQUISITES section above.

  3. In the settings.xml, the <username> element must be deploy#string.


The snapshot repositories can be accessed by using either http or https.  If you want to use https, then you must enable Maven for SSL operations.  Click here for instructions on how to use SSL with Maven.  Using https is highly recommended when using snapshot repositories.

1. the setting.xml <server> element configuration

<servers>
    ...
    <server>
        <id>mySnapshotRepo</id>
        <username>deploy#string</username>
        <password>myTeamListName</password>
    </server>
    ...
</servers>


where myTeamListName has the form dvtl<Team ID>.

Example: if your Team ID is uadev, then the <password> element would be <password>dvtluadev</password>.


2. the Maven pom.xml <distributionManagement> element configuration

  • A snapshot repository can be accessed directly by adding the <distributionManagement> element below to your pom.xml:

    <distributionManagement>
        ...
        <repository>
            <id>mySnapshotRepo</id>
            <name>This is my snapshot repository</name>
            <url>https://maven.mit.edu/nexus/content/repositories/snapshotRepo</url>
        </repository>
        ...
    </distributionManagement>
    
    note: In the above <url> tag, snapshotRepo must be replaced with the name of your snapshot repository.

  • No labels