How do I deploy a plugin to an Archiva repository?
Author: Deron Eriksson
Description: This tutorial describes how to deploy a custom-written plugin to a Archiva maven repository.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)


Page:    1 2 >

In another tutorial, we created a "maven-howdy-plugin" mavenSW plugin project and installed it in our local repository. If we deploy the plugin to a remote repository, other developers can also use the plugin, which of course is important in a team programming environment. We can deploy a project with "maven-plugin" packaging just like we would any other maven artifact.

I have an ArchivaS repository set up, and I deploy to this repository using Webdav. To do this, in my user settings.xml file, I specify the name/password that I will use to connect to the internal (versioned jarW file) repository and the snapshot repository:

Server entries from settings.xml

...
		<server>
			<id>archiva.internal</id>
			<username>admin</username>
			<password>admin1</password>
		</server>
		<server>
			<id>archiva.snapshots</id>
			<username>admin</username>
			<password>admin1</password>
		</server>
...

I modified my pom.xml file of my plugin project to include a distributionManagement section. This specifies that if I deploy a versioned plugin, it will go to the "Internal Release Repository" repository. If I deploy a snapshot, it will go to the "Internal Snapshot Repository" repository. The name/password for each of these is contained in the settings.xml server entries that we saw above. Since I'm going to deploy using webdav, I need to include the "wagon-webdav" extension in my pom.xml.

pom.xml

<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.maventest</groupId>
	<artifactId>maven-howdy-plugin</artifactId>
	<packaging>maven-plugin</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>Howdy Plugin</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-plugin-api</artifactId>
			<version>2.0</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<extensions>
			<!-- begin - needed for deploying to repository using webdav -->
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-webdav</artifactId>
				<version>1.0-beta-2</version>
			</extension>
			<!-- end - needed for deploying to repository using webdav -->
		</extensions>
	</build>
	<distributionManagement>
		<repository>
			<id>archiva.internal</id>
			<name>Internal Release Repository</name>
			<url>dav:http://192.168.1.7:8081/archiva/repository/internal</url>
		</repository>
		<snapshotRepository>
			<id>archiva.snapshots</id>
			<name>Internal Snapshot Repository</name>
			<url>dav:http://192.168.1.7:8081/archiva/repository/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
</project>

Now I'll perform a "mvn clean deploy" on the "maven-howdy-plugin" project:

Executing 'mvn clean deploy' on 'maven-howdy-plugin' project

(Continued on page 2)

Page:    1 2 >