> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/containerized-steps/download-nexus-artifact-step.md).

# Download Nexus Artifact

Download a raw, Maven, npm, or NuGet asset from a Nexus repository inside a containerized step group

{% hint style="info" %}
This feature is in Beta[^1] and requires enablement. [View all early access features.](/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="continuous-delivery" pagePath="continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/containerized-steps/download-nexus-artifact-step" featureFlags="%5B%7B%22name%22%3A%22Download%20Nexus%20Artifact%20step%22%2C%22key%22%3A%22CDS\_DOWNLOAD\_NEXUS\_ARTIFACT%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Adds%20a%20native%20Download%20Nexus%20Artifact%20step%20to%20containerized%20step%20groups%2C%20so%20a%20pipeline%20can%20pull%20a%20raw%2C%20Maven%2C%20npm%2C%20or%20NuGet%20asset%20from%20a%20Nexus%20repository%20without%20a%20custom%20plugin%20or%20shell%20script.%22%7D%5D" %}
{% endhint %}

{% hint style="info" %}
**Containerized step group required**

The **Download Nexus Artifact** step is only available when used within a [containerized step group](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/containerized-steps/containerized-step-groups.md).
{% endhint %}

The **Download Nexus Artifact** step downloads a single asset from a Nexus repository into your containerized step group, so later steps in the step group can use it. It supports raw, Maven, npm, and NuGet repository formats. Use it instead of a custom plugin or shell script when you need to pull a build dependency, SDF bundle, or evidence file from Nexus directly into a pipeline.

***

## What you will learn from this topic

* How to add the **Download Nexus Artifact** step and configure its settings
* How to provide artifact coordinates for each supported repository format
* How to control the download location and checksum validation

***

## Before you begin

* **Nexus connector**: Connect Harness to your Nexus server. The connector can use Anonymous or Username/Password authentication; if the repository allows anonymous access, you do not need to configure credentials. Go to [Add a Nexus connector](https://developer.harness.io/docs/platform/connectors/artifact-repositories/add-a-nexus-connector) to create one.
* **Containerized step group**: Add the step inside a [containerized step group](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/containerized-steps/containerized-step-groups.md) that runs on Kubernetes, VM, or Amazon ECS infrastructure.

***

## Add the Download Nexus Artifact step

Add the **Download Nexus Artifact** step to your containerized step group, and configure the settings described below.

The following YAML example downloads a Maven artifact:

```yaml
- step:
    type: DownloadNexusArtifact
    name: Maven
    identifier: Maven
    spec:
      connectorRef: nexus3_connector
      repository: maven-releases
      repositoryFormat: maven
      spec:
        groupId: io.harness.demo
        artifactId: todolist
        version: v2
        extension: jar
```

The following YAML example downloads a raw asset:

```yaml
- step:
    type: DownloadNexusArtifact
    name: Raw
    identifier: Raw
    spec:
      connectorRef: nexus3_connector
      repository: raw-releases
      repositoryFormat: raw
      spec:
        group: /release/1.4.2
        artifactPath: bundle-1.4.2.zip
```

### Download Nexus Artifact step settings

**Name**

Enter a name summarizing the step's purpose. Harness generates an **Id** ([Entity Identifier](https://developer.harness.io/docs/platform/references/entity-identifier-reference/)) based on the **Name**. You can edit the **Id**.

**Nexus Connector**

Select the [Nexus connector](https://developer.harness.io/docs/platform/connectors/artifact-repositories/add-a-nexus-connector) to use when connecting to your Nexus server.

**Repository Format**

Select the format of the Nexus repository the asset lives in: **Raw**, **Maven**, **NPM**, or **NuGet**. Harness does not support the Docker format for this step, because a container image is not a single downloadable file.

You must set **Repository Format** to a fixed value. It does not accept a runtime input or an expression, because Harness uses it to determine which coordinate fields to show and validate before the pipeline runs.

**Repository**

Select or enter the name of the Nexus repository the asset lives in.

### Raw repository coordinates

When **Repository Format** is **Raw**, provide the following coordinates.

**Group**

The directory the asset lives in, such as `/release/1.4.2`.

**Artifact Path**

The file name of the asset within **Group**, such as `bundle-1.4.2.zip`.

### Maven repository coordinates

When **Repository Format** is **Maven**, provide the following coordinates.

**Group Id**

The Maven group ID of the artifact.

**Artifact Id**

The Maven artifact ID of the artifact.

**Version**

The version of the artifact. This accepts a release version, a `-SNAPSHOT` version such as `1.0.0-SNAPSHOT`, or a pinned timestamped snapshot build such as `1.0.0-20240101.120000-1`.

**Extension**

Optional, but in practice usually required. A Maven coordinate normally matches both a JAR and a POM in a hosted repository, so omitting **Extension** usually fails the step rather than being a minor convenience. Set **Extension** (for example `jar`) to identify the asset you want.

**Classifier**

Optional. The Maven classifier of the artifact, such as `sources`. When you do not set **Classifier**, the step excludes classified assets (such as `-sources` or `-javadoc`) from the match, so they are not the cause of an ambiguous match. An unset **Extension** is the usual cause.

### Resolving ambiguous Maven coordinates

If **Group Id**, **Artifact Id**, **Version**, **Extension**, and **Classifier** together match more than one asset, the step's behavior depends on whether the matches are identical:

* If every match has identical content, which is common when **Repository** points at a group repository that mirrors the same artifact from more than one member repository, the step downloads the first match and logs that it did so.
* If the matches differ in content, the step fails. The failure message lists each match along with the member repository it came from, so you can set **Repository** to that specific member repository to resolve the ambiguity.

### NPM and NuGet repository coordinates

When **Repository Format** is **NPM** or **NuGet**, provide the following coordinates.

**Package Name**

The name of the npm or NuGet package.

**Version**

The version of the package.

For NuGet, the Nexus asset path does not carry a file name, so the step names the downloaded file `<Package Name>.<Version>.nupkg`.

***

## Optional settings

**Download Directory Path**

The directory, inside the container, to download the asset to. If you do not specify a path, Harness downloads the asset to `/harness/<step Id>`.

**Validate Checksum**

Validates the downloaded asset's checksum against Nexus. Enabled by default. If Nexus reports no checksum for the asset, the step logs a warning and succeeds without performing validation.

**Run as User**

Specify the user ID to use to run all processes in the pod if running in containers. Go to [Set the security context for a pod](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) to configure the pod security context.

**Privileged**

Enable this option to run the container with escalated privileges. This is equivalent to running a container with the Docker `--privileged` flag. Most Nexus downloads do not need this.

**Set Container Resources**

Maximum resource limits for the resources used by the container at runtime:

* **Limit Memory**: Maximum memory that the container can use. You can express memory as a plain integer or as a fixed-point number with the suffixes `G` or `M`. You can also use the power-of-two equivalents, `Gi` or `Mi`. Do not include spaces when entering a fixed value.
* **Limit CPU**: The maximum number of cores that the container can use. CPU limits are measured in CPU units. Fractional requests are allowed. For example, you can specify one hundred millicpu as `0.1` or `100m`. Go to [Resource units in Kubernetes](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes) to review Kubernetes resource unit syntax.

**Timeout**

Set the timeout limit for the step. Once the timeout limit is reached, the step fails. What happens next depends on the step's failure strategy; by default, the stage fails. To set skip conditions or failure handling for steps, go to:

* [Step Skip Condition settings](https://developer.harness.io/docs/platform/pipelines/step-skip-condition-settings)
* [Step Failure Strategy settings](https://developer.harness.io/docs/platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps)

### Output file paths

The YAML-only `outputFilePathsContent` field takes a list of file paths, each resolved relative to the download directory, not the Nexus repository. This field is not yet available in the Visual pipeline editor.

For each path, after the download completes, Harness publishes the file's content as a step output variable, keyed by the path exactly as you wrote it. The published value is not the raw file content: Harness base64-encodes it and replaces the `=` padding characters with `-`, because the output-variable format cannot carry `=` in a value.

```yaml
- step:
    type: DownloadNexusArtifact
    name: Maven
    identifier: Maven
    spec:
      connectorRef: nexus3_connector
      repository: maven-releases
      repositoryFormat: maven
      spec:
        groupId: io.harness.demo
        artifactId: todolist
        version: v2
        extension: jar
      outputFilePathsContent:
        - version.txt
```

To use the value, read it back in a later step and reverse the encoding. For example, a Shell Script step in the same stage can decode `version.txt` like this:

```yaml
- step:
    type: ShellScript
    name: Read Version
    identifier: Read_Version
    spec:
      shell: Bash
      source:
        type: Inline
        spec:
          script: |-
            echo '<+steps.Maven.output.outputVariables["version.txt"]>' | tr '-' '=' | base64 -d
```

Harness has no built-in expression function that decodes this value for you; the `tr` and `base64 -d` steps shown above have to run in the consuming step itself. From a later stage instead of a later step in the same stage, use `<+pipeline.stages.<stageId>.spec.execution.steps.Maven.output.outputVariables["version.txt"]>`.

***

## Important notes

* **Repository Format** determines the shape of the coordinate fields and cannot be a runtime input or an expression. **Nexus Connector**, **Repository**, **Download Directory Path**, and the coordinate fields inside **Repository Format**, such as **Version** or **Artifact Path**, all accept runtime inputs and expressions.
* Docker is not a supported repository format for this step.

***

## Next steps

* Go to [Containerize step groups](/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/containerized-steps/containerized-step-groups.md) to run this step on Kubernetes, VM, or Amazon ECS infrastructure.
* Go to [Add a Nexus connector](https://developer.harness.io/docs/platform/connectors/artifact-repositories/add-a-nexus-connector) to set up the connector this step needs.

{% @harness-feedback/feedback %}

[^1]: Off by default. If you want to try it and share feedback, request access and Harness will turn it on for your account. Beta features can change and may not be ready for production use.
