Maven Plugin
The Harness Maven Plugin simplifies Maven project integration with Harness Artifact Registry by automating artifact deployment and dependency management directly from your Maven build lifecycle.
The plugin provides two main capabilities:
Deploy Artifacts: Automatically upload your Maven artifacts (JARs, WARs, POMs, etc.) to Harness Artifact Registry during the Maven build process
Enforce Dependency Resolution: Ensure all Maven dependencies are fetched through your Harness upstream proxy registries, providing centralized control over your project's dependencies
Installation
Add the plugin to your project's pom.xml:
<build>
<plugins>
<plugin>
<groupId>io.harness.maven</groupId>
<artifactId>harness-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>deploy-artifacts</id>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>Using SNAPSHOT Versions
If you are using a SNAPSHOT version of the plugin (e.g., 1.0.0-SNAPSHOT), add the snapshot repository to resolve it:
Configuration
The plugin uses environment variables for configuration. Set these variables before running Maven commands.
Deployment Configuration
Configure deployment to Harness Artifact Registry:
Resolution Configuration (Optional)
To enforce dependency resolution through Harness upstream proxy, configure these variables:
Configuration Reference
DEPLOY_REPO_URL
Repository URL for deployment
Yes (for deploy)
DEPLOY_USERNAME
Username for deployment
Yes (for deploy)
DEPLOY_TOKEN
Token/password for deployment
Yes (for deploy)
DEPLOY_THREAD_COUNT
Number of threads for parallel deployment (default: CPU cores)
No
RESOLVER_REPO_URL
Repository URL for dependency resolution
Yes (for enforce-resolution)
RESOLVER_USERNAME
Username for resolution
Yes (for enforce-resolution)
RESOLVER_TOKEN
Token/password for resolution
Yes (for enforce-resolution)
Usage
Deploy Artifacts
Deploy your Maven project artifacts to Harness Artifact Registry:
The plugin will:
Build your project artifacts
Upload artifacts to the configured Harness registry
Use parallel threads for faster deployment (configurable via
DEPLOY_THREAD_COUNT)
Configure Deployment Thread Count (Optional)
By default, the plugin uses the number of CPU cores for parallel deployment. You can override this:
Enforce Dependency Resolution
Force all Maven dependencies to resolve from Harness upstream proxy:
This ensures all dependencies are fetched through your Harness upstream proxy registry, providing centralized control over your project's dependencies.
Skip Deployment for Specific Modules
If you have modules that should NOT be deployed (e.g., documentation modules, test modules, parent POMs), configure them individually:
The Harness Maven Plugin automatically respects this configuration and skips those modules during deployment.
Example Workflow
Here's a complete example of using the Harness Maven Plugin in a CI/CD pipeline:
Last updated
Was this helpful?