Artifactory (Maven)

Configure JFrog Artifactory for NES Maven artifacts

This guide describes how to add the HeroDevs NES Maven Repository to a JFrog Artifactory instance.

  1. Create a Remote Repository for our private Maven repo
  2. Configure an existing (or create a new) Virtual Repository
  3. Verify your access

Create a Maven Remote Repository

  1. Under Administration, navigate to Repositories > and select Remote
  2. Select Create a Repository > Remote > Maven
  3. Configure the following on the Basic tab
    Note: See here for documentation on basic settings for Remote Repositories

Basic Settings

"Step 1 Basic"

Select Test to verify your token access.

Advanced Settings

Configure the following on the Advanced tab:

"Step 1 Advanced"

Configure a Virtual Repository

This step will provide configuration details to configure an Artifactory virtual repository used to access artifacts in Maven and Gradle projects.

Assumptions:

  • A Maven repository has been configured to access our NES Maven repository keyed as nes (see Step 1).

If you already have a Virtual Repository configured with Maven Central (and potentially other sources) you can skip the following steps.

  1. Under Administration, navigate to Repositories > and select Virtual
  2. Select Create a Repository > Virtual > Maven
    • This sample keys the virtual repository with the name maven-default.

Whether creating or editing a new Virtual Repository, add nes-maven to the list of Selected Repositories.

Sample

"Virtual Maven Repository"

::

Check Permissions

Ensure that your Artifactory users have Read permissions to the nes remote repository and the maven-default virtual repository. This can be done by editing an existing permission target or creating a new one. The Artifactory documentation has more information on setting up permissions.

Verify Setup

Assuming your Virtual Repository was keyed as maven-default, and that you have a valid Artifactory token, configure your Maven settings or Gradle properties accordingly.

Maven (~/.m2/settings.xml)
Gradle (~/.gradle/gradle.properties)
<settings>
  <servers>
    <!-- other servers -->
    <server>
      <id>artifactory</id>
      <username>artifactory-user@email-address</username>
      <password>artifactory-token</password>
    </server>
  </servers>
  <profiles>
    <!-- other profiles -->
    <profile>
      <id>artifactory</id>
      <repositories>
        <repository>
          <id>artifactory</id>
          <name>maven-default</name>
          <url>https://company.jfrog.io/artifactory/maven-default</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>artifactory</id>
          <name>maven-default</name>
          <url>https://company.jfrog.io/artifactory/maven-default</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!-- other active profiles -->
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

Debugging Steps

Verify NES Maven Repository Access

If you are having trouble accessing artifacts from the NES Maven repository with Artifactory, the following steps can help verify access to a public trial artifact and eliminate potential networking issues:

  1. Verify access to a public trial artifact:
  • Run the following command to test access to a public trial artifact:
curl -L -i -u "trial:trial" https://registry.nes.herodevs.com/maven/org/springframework/spring-core/5.3.39-spring-framework-5.3.42-trial/spring-core-5.3.39-spring-framework-5.3.42-trial.pom
  1. Verify the response
  • You should see a 200 OK response and the POM file contents.
  • If using a browser, the POM file should be displayed or downloaded automatically.
  1. If unsuccessful, check the following:
  • Try a different network to rule out local network issues.
  • Disconnect from any VPNs that may be interfering with access.
  • Ensure your network configuration allows access to the following domains registry.nes.herodevs.com and assets.nes.herodevs.com
  • If none of these steps resolve the issue, please contact HeroDevs support.

Verify your token access to a private package

Now that network access is verified, let's check your access token:

  1. Verify that your token is valid and has not expired.
  2. If you have multiple tokens, ensure you are using the correct token for the product you are trying to access.
  3. Select a test package to verify access:
  • Maven packages are listed under the product’s Additional Information > Published Maven Packages section.
  • Using the groupId, artifactId, and version of a package, construct the URL to verify access:
    • https://registry.nes.herodevs.com/maven/{groupId with slashes}/{artifactId}/{version}/{artifactId}-{version}.pom
    • For example, for the spring-core package mentioned above, the URL would be: https://registry.nes.herodevs.com/maven/org/springframework/spring-core/5.3.39-spring-framework-5.3.48/spring-core-5.3.39-spring-framework-5.3.48.pom
  1. You can use curl or a browser to verify access to the package:
  • run
    curl -L -i -u "artifactory:{your token}" https://registry.nes.herodevs.com/maven/{groupId with slashes}/{artifactId}/{version}/{artifactId}-{version}.pom
    
  • Alternatively, in a browser (recommended using Incognito/Private mode), navigate to:
    • https://registry.nes.herodevs.com/maven/{groupId with slashes}/{artifactId}/{version}/{artifactId}-{version}.pom
    • You should be prompted for a username and password. Use artifactory for the username and your token as the password.
  1. If unsuccessful, check the following:
  • Ensure you are using the correct token for the package you are trying to access.
  • If you continue to have issues, please contact HeroDevs support.

Verify Configuration

Verify your Artifactory configuration:

  1. Verify setup:
  • Verify that the URL for the remote repository is https://registry.nes.herodevs.com/maven
    • Verify that the Test URL is successful in the remote repository settings.
  • Verify that the subscription token from above is correctly configured in the remote repository settings.
  • Verify that the include patterns are correctly configured in the remote repository settings.
  • Verify that the remote repository is included in the virtual repository.
  1. Generate a new token to eliminate any issues with the current token.
  • Navigate to Administration (top) > Repositories (Left) > Set Me Up (Top Right)
  • Select Maven
  • Select the virtual repository you configured (e.g. maven-default)
  • Select the correct remote for Releases
  • Select Generate to generate a new token and click Generate Settings
  • Save the token ARTIFACTORY_TOKEN and url ARTIFACTORY_URL from the generated settings.
  1. Use the new token to verify access to the test package above using curl.
  • run
    curl -H "Authorization: Bearer ${ARTIFACTORY_TOKEN}" ${ARTIFACTORY_URL}/{groupId with slashes}/{artifactId}/{version}/{artifactId}-{version}.pom
    
  1. You should see a 200 OK response and the POM file contents.
  • The file should now be cached in Artifactory. You can verify this by navigating Platform (top) > Artifacts (Left) > {remote repository name}-cache (e.g. nes) > navigate to the package path.
  • If your build tool (Maven or Gradle) is still unable to download the package, but you have verified that you can access the package using curl, please check permissions in Artifactory.
    • Ensure that your user has Read permissions to the nes remote repository and the maven-default or equivalent virtual repository.
    • This can be done by editing an existing permission target or creating a new one.
    • This link has more information on setting up permissions.
  1. If you do not see a 200 OK response, this indicates an issue with your Artifactory configuration. Double-check the configuration steps above.
  • Check the response for code and details to help identify the issue.
  • Contact HeroDevs support with details of the steps you have taken and any error messages you have received.

Common Problems and Solutions

Connection to remote repository failed: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

  • The URL for the remote repository is incorrect. Verify that the URL is https://registry.nes.herodevs.com/maven
  • There is a network issue preventing Artifactory from reaching the remote repository.
    • Please check your network configuration and ensure registry.nes.herodevs.com and assets.nes.herodevs.com are domains are allowed.
  • Under the remote repository basic settings, ensure Test URL is successful.

Status code: 403 with message: Download request for repo:path '{repo}:{path}' is forbidden for user: '{user}'

  • This error indicates that the token used to access the remote repository does not have permission to access the requested artifact.
  • For more information on access and permissions, please see Artifactory Permissions.