Deploying With Webdav
|
As of Maven 2.0.9 it is no longer nessesary to add the build extension to your project. |
The simplest way to enable webdav deployment is to add a build extension to your project:
<project>
...
<build>
...
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
</build>
...
</project>
To use mvn deploy:deploy-file with webdav, save a simple pom.xml containing wagon-webdav as a build extension in the directory from which you execute 'mvn'. (You may need to rename the pom for the project you are deploying.)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>webdav-deploy-pom</artifactId> <packaging>pom</packaging> <version>1</version> <name>Webdav Deployment POM</name> <build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav</artifactId> <version>1.0-beta-2</version> </extension> </extensions> </build> </project>
Example:
mvn deploy:deploy-file -Dfile=example.jar -DpomFile=example.pom -DrepositoryId=myrepo -Durl=dav:http://localhost:8080/archiva/repository/myrepo
You can also point Maven at an alternate pom file with -f on the command line.
Example:
mvn deploy:deploy-file -f /path/to/webdav-deploy-pom.xml -Dfile=example.jar -DpomFile=example.pom -DrepositoryId=myrepo -Durl=dav:http://localhost:8080/archiva/repository/myrepo
Alternate method, modifying the Maven distribution
Given that maven 2 doesn't currently include the wagon-webdav plug-in in its core, here's how to add it:
svn co http://svn.apache.org/repos/asf/maven/components/branches/maven-2.0.x
add to maven-2.0.x/pom.xml
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-1</version>
</dependency>
add to maven-2.0.x/maven-core/pom.xml
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<scope>runtime</scope>
</dependency>
then...
mvn clean install cd maven-core mvn assembly:assembly cd target
and finally install your new maven-2.0.5-SNAPSHOT-bin...
The examples from the guide to deploying 3rd party jars will now work in the following context:
mvn deploy:deploy-file -Durl=dav:http://my.maven.repo/ -DrepositoryId=id.from.settings.xml -DpomFile=whatever.pom -Dfile=whatever.jar

Comments (4)
Jul 05, 2006
carlos says:
I think this is TOO much You just need to copy to your $M2_HOME/lib http://www...I think this is TOO much
You just need to copy to your $M2_HOME/lib
http://www.ibiblio.org/maven2/org/apache/maven/wagon/wagon-webdav/1.0-beta-1/wagon-webdav-1.0-beta-1.jar
http://www.ibiblio.org/maven2/slide/slide-webdavlib/2.1/slide-webdavlib-2.1.jar
http://www.ibiblio.org/maven2/commons-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar
http://www.ibiblio.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar
http://www.ibiblio.org/maven2/jdom/jdom/1.0/jdom-1.0.jar
http://www.ibiblio.org/maven2/de/zeigermann/xml/xml-im-exporter/1.1/xml-im-exporter-1.1.jar
Not sure if there are missing jars or too many listed, but in any case you don't need to build from scratch
Jul 05, 2006
carlos says:
Seems that there is no need for jdom or xml-im-exporter.Seems that there is no need for jdom or xml-im-exporter.
Sep 26, 2007
Tarek El-Sibay says:
I tried to use it with wagon-webdav-1.0-beta-2. i had to add plexus utils to&nbs...I tried to use it with wagon-webdav-1.0-beta-2. i had to add plexus utils to $M2_HOME/lib
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.4/plexus-utils-1.4.jar
Mar 26, 2008
Nayan Hajratwala says:
I only had to add these jar files when doing a maven multimodule project deploym...I only had to add these jar files when doing a maven multimodule project deployment. In anycase, I've posted the minimal list of jars that I needed here:
http://agileshrugged.com/blog/?p=34