This deploy phase copies:
to a remote repository for sharing with other developers and projects.
In most project builds, the deploy phase of the build lifecycle is implemented using the deploy:deploy mojo
See also: the install phase to install your software in a local repository.
The whole configuration is done in the pom.xml file
<build>
<!-- To define the plugin version in your parent POM -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
...
</plugins>
</pluginManagement>
<!-- To use the plugin goals in your POM or parent POM -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
...
</plugins>
</build>
To enable the deploy plugin to function, a valid in the pom.xml must be included with:
<distributionManagement>
<repository>
<id>myRepositoryId</id>
<name>Repository name</name>
<url>Host to Company Repository</url>
</repository>
<snapshotRepository>
<id>mySnapshotRepositoryId</id>
<name>Snapshot Repository name (For instance: Internal Release)</name>
<url></url>
</snapshotRepository>
<site>
<id>mySiteRepositoryId</id>
<name>my Site Name</name>
<url>myURL</url>
</site>
</distributionManagement>
Url follows the URI specification and specifies both the transport protocol (scheme) and the location to be used to transfer a built artifact
Maven Wagon is a file (transfer|transport) application with modules (FTP, SSH, …)
For SSH (scp, sftp), you need to use the following module:
<build>
<extensions>
<!-- Enabling the use of SSH -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
</build>
In most cases, the deploy mojo is invoked when you call the deploy phase of the default build lifecycle.
mvn deploy
Artifacts which are not built using Maven can be added to any remote repository using the deploy-file.
mvn deploy:deploy-file -Durl=file://C:\m2-repo \ (or scp://host.com/path/to/repo)
-DrepositoryId=some.id \
-Dfile=your-artifact-1.0.jar \
[-DpomFile=your-pom.xml] \
[-DgroupId=org.some.group] \
[-DartifactId=your-artifact] \
[-Dversion=1.0] \
[-Dpackaging=jar] \
[-Dclassifier=test] \
[-DgeneratePom=true] \
[-DgeneratePom.description="My Project Description"] \
[-DrepositoryLayout=legacy] \
[-DuniqueVersion=false]
where: