Set up the Maven access to the censhare Artifactory.

Introduction

censhare uses Artifactory as central repository. In Artifactory, Jcenter stores Java-related code (for example: libraries).  If you use Maven to build censhare projects, you must configure the Maven access to Jcenter. This is done in a settings.xml file in your maven configuration folder. 

The following steps lead through the set up and configuration of the Maven access. When you download the snippet with the settings, Artifactory configures the access to the repository with your username and LDAP password. The password is encrypted but can easily be decrypted by public available tools. For this reason, you must replace the password with your API key at the end of the configuration process.

Steps

  1. Go to the censhare Artifactory home page: https://artifactory.censhare.com/artifactory/webapp/#/home.
  2. In the Set Me Up section, find Jcenter:

  3. Press Generate Maven Settings in the SET ME UP window:
  4. Type your password and click the arrow:
  5. Select Generate Settings:
  6. Click Download Snippet:

  7. Generate and download your API key. Replace USER with your LDAP login name:

    curl -u USER -X POST "https://artifactory.censhare.com/artifactory/api/security/apiKey"

     

  8. If you have already generated the API key, the command above throws an error. In this case, regenerate the API key with the following command:

    curl -u USER -X PUT "https://artifactory.censhare.com/artifactory/api/security/apiKey"
  9. Copy the API key.
  10. Open the downloaded settings.xml in an editor and go to the <servers> section:

    If your settings.xml file has no <servers> section, copy the <servers/> snippet below and add it as shown.

    settings.xml
    <settings ...>
      <servers>
        <server>
          <username>wv</username>
          <password>XXX-XX-XXX</password>
          <id>central</id>
        </server>
        <server>
          <username>wv</username>
          <password>XXX-XX-XXX</password>
          <id>snapshots</id>
        </server>
      </servers>
      <profiles>
        <profile> 
    ...
  11. Replace the encrypted LDAP password XXX-XX-XXX with your downloaded API key and save your changes.

  12. Copy the file to your maven folder:

    cp settings.xml ~/.m2/