For the complete documentation index, see llms.txt. This page is also available as Markdown.

Maven

spinner

Prerequisites

  • Ensure you have the Maven CLI (mvn) installed on your local machine.

  • Access to a Harness account with appropriate permissions to create registries and connectors.


Create a Maven Artifact Registry

Creating a New Maven Artifact Registry
  1. Navigate to the Artifact Registry module in your Harness project.

  2. Click on New Artifact Registry.

  3. In the Registry Type dropdown, select Maven Registry.

  4. Provide a Registry Name.

REGISTRY NAME CRITERIA

Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.

  1. Optionally, add a Description and Labels for better organization.

  2. Choose visibility between Public and Private.

  3. Click Create Registry to finalize.

PRIVATE REGISTRY

This registry will serve as your private Maven registry within Harness.


Configure an Upstream Proxy (Optional)

An upstream proxy allows your registry to fetch Maven packages from external sources if they are not available locally.

Create an upstream proxy

Create Maven Upstream Proxy in Harness

Configure the upstream proxy in your registry

Configure Maven Upstream Proxy

Create an upstream proxy

1. In the Artifact Registry module, click the dropdown next to **New Artifact Registry** and select **Upstream Proxy**. 2. Choose **Maven Registry** as the proxy type. 3. Click **Create Proxy** to establish the connection.

Configure the upstream proxy in your registry

1. In the Artifact Registry module, select an existing Artifact Registry. 2. Select the **Configuration** tab. 3. Under **Advanced (Optional)**, select **Configure Upstream**. 4. Select from the list of compatible proxies to add them to your registry. 5. Click **Save** to save the configuration.

UPSTREAM PROXY CACHING

If a Maven package isn’t found in your Harness registry, the upstream proxy fetches it from an external registry like Maven Central, reducing duplication and improving resolution.


Push & Pull Maven Packages

Authenticate the CLI with the Harness Registry

  1. In your Harness Maven Artifact Registry, click Setup Client.

  2. Click Generate Identity Token to generate a new token that serves as the password for uploading and downloading artifacts.

Publish a Package to the Registry

  1. Set default repository in your pom.xml file.

  1. Copy the following your ~/ .m2/setting.xml file for MacOs, or $USERPROFILE$\ .m2\settings.xml for Windows to authenticate with token to push to your Maven registry.

  1. Publish the package:

Pull a Package from the Registry

Set default repository in your pom.xml file.

  1. Set the default registry in your pom.xml file by adding the following:

  1. Copy the following your ~/ .m2/settings.xml file for MacOs, or $USERPROFILE$\ .m2\settings.xml for Windows to authenticate with token to pull from your Maven registry.

  1. Add a dependency to the project's pom.xml (replace GROUP_ID, ARTIFACT_ID & VERSION with your own):

  1. Pull the package:

USAGE

These commands upload or retrieve Maven packages between your local project and the Harness registry.


Last updated

Was this helpful?