Install and Deploy

If you want to share your built artifacts between projects, you can use two other tasks: install for installing them in your local repository for access as dependencies in other scripts, and deploy for deploying them to a remote location you have set up to serve as a repository in your organisation.

Note: that the installation and deployment require that you have a Maven 2.0 POM file to deploy along with it. These are required for the transitive dependency mechanism to work effectively, and can be quite simple to create.

The following example shows basic use of the install and deploy tasks.

...
  <artifact:pom id="mypom" file="pom.xml" />

  <artifact:install file="target/my-project-1.0.jar">
    <pom refid="mypom"/>
  </artifact:install>

  <artifact:deploy file="target/my-project-1.0.jar">
    <remoteRepository url="file://localhost/www/repository"/>
    <pom refid="mypom"/>
  </artifact:deploy>
...

For deploying using a protocol other than local file system, you need to register a provider to make the other protocols available. For example:

...
  <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>

  <artifact:deploy file="target/my-project-1.0.jar">
    <remoteRepository url="scp://localhost/www/repository">
      <authentication username="${repository.username}" privateKey="${user.home}/.ssh/id_dsa"/>
    </remoteRepository>
    <pom refid="mypom"/>
  </artifact:deploy>
...

Note: that if you use antcall, the provider isn't available during the Ant call: you have to register it again if you need it.

Maven Ant Tasks contain wagon-file and wagon-http-lightweight providers. The other available providers are:

Protocol Artifact ID Version
http wagon-http 1.0-beta-2
scp wagon-ssh 1.0-beta-2
scpexe wagon-ssh-external 1.0-beta-2
ftp wagon-ftp 1.0-beta-2
webdav wagon-webdav 1.0-beta-2