Maven deploy Plugin

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

The deploy plugin copies artifacts into a remote repository (the install plugin copies artifacts into the local repository). The remote repository to upload to is configured in the <distributionManagment> section:

<distributionManagement>
    <repository>
        <id>nexus</id>
	<url>https://nexus-cicd.apps.openshift.novaordis.io/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
        <id>nexus</id>
	<url>https://nexus-cicd.apps.openshift.novaordis.io/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

Running as Part of a Lifecycle

See:

The install plugin - Running as Part of a Lifecycle

Examples

Deploy Arbitrary Files in the Local Repository

mvn deploy:deploy-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B \
     -Dpackaging=jar -Dfile="C:\tmp\jta-1.0.1B.jar" \
     -Durl="file://C:\Documents and Settings\user1\.m2" -DrepositoryId=repository

Deploy Arbitrary Files in a Remote Repository

mvn deploy:deploy-file -DgroupId=ec.template -DartifactId=test -Dversion=1 -Dpackaging=zip \
   -Dfile=./test.zip -Durl=https://username:mypasswd@example.com/nexus/content/repositories/libs-release-local/blah

This will create (with appropriate permissions) https://example.com/nexus/content/repositories/libs-release-local/blah/ec/template/test/1/test-1.zip

Note that if the source file is in the local maven repository, deploy:deploy-file will fail:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Cannot deploy artifact from the local repository: /Users/someuser/.m2/repository/com/example/something/1.0.0/something-8.0.0.jar -> [Help 1]

Deploying Programmatically an Artifact under a Different Name than its artifactId

See:

install plugin - Deploying Programmatically an Artifact under a Different Name than its artifactId