| Apache Archiva > Index > Upload artifacts |
Archiva natively supports webdav to upload artifacts on a managed repository.
<settings> <servers> <server> <id>YOUR_REPO_ID</id> <username>USERNAME</username> <password>PASSWORD</password> </server> </servers> </settings>
# Repository to deploy to
#maven.repo.list=YOUR_REPOSITORY_FOR_SNAPSHOTS_ID
#maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID=dav:YOUR_REPOSITORY_FOR_RELEASES_URL
#maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID.directory=/
# These must be set elsewhere
#maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID.username=
#maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID.password=
# Repository to deploy snapshots
#maven.repo.YOUR_REPOSITORY_FOR_SNAPSHOTS_ID=dav:YOUR_REPOSITORY_FOR_SNAPSHOTS_URL
#maven.repo.YOUR_REPOSITORY_FOR_SNAPSHOTS_ID.directory=/
#maven.repo.YOUR_REPOSITORY_FOR_SNAPSHOTS_ID.username=${maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID.username}
#maven.repo.YOUR_REPOSITORY_FOR_SNAPSHOTS_ID.password=${maven.repo.YOUR_REPOSITORY_FOR_RELEASES_ID.password}
Maven 2.0.x does not yet natively support the webdav protocol to upload artifacts. See http://jira.codehaus.org/browse/MNG-2664 for more information.
Meanwhile, you can use a simple pom.xml file containing the wagon-webdav build extension, as described here: http://maven.apache.org/archiva/guides/getting-started/maven-configuration.html
And then deploy your artifact:
mvn deploy:deploy-file \
-DrepositoryId=<YOUR_REPO_ID> \
-Durl=dav:<YOUR_REPO_URL> \
-DgroupId=<GROUP_ID> \
-DartifactId=<ARTIFACT_ID> \
-Dversion=<VERSION> \
-Dpackaging=<PACKAGING> \
-Dfile=<FILE_PATH>
or (note that pomFile is pom that goes with the artifact, not the simple one mentioned above.)
mvn deploy:deploy-file \
-DrepositoryId=<YOUR_REPO_ID> \
-Durl=dav:<YOUR_REPO_URL> \
-DpomFile=<POM_FILE_PATH>\
-Dfile=<FILE_PATH>
You need to tell the <build> section about the Wagon WebDAV plugin:
<build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav</artifactId> <version>1.0-beta-1</version> </extension> </extensions> ... </build>
Next you'll need to update your distributionManagement section:
<distributionManagement> <repository> <id>YOUR_REPOSITORY_FOR_RELEASES_ID</id> <name>Central Repository</name> <url>dav:YOUR_REPOSITORY_FOR_RELEASES_URL</url> </repository> <snapshotRepository> <id>YOUR_REPOSITORY_FOR_SNAPSHOTS_ID</id> <name>Central Development Repository</name> <url>dav:YOUR_REPOSITORY_FOR_SNAPSHOTS_URL</url> </snapshotRepository> </distributionManagement>
You can put <distributionManagement> in the parent pom for a multi-module project. It will be inherited by the child projects, which can override it if necessary.
$ mvn deploy