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


Page: < 1 2

(Continued from page 1)

The artifact is now deployed to the snapshots repository. I went into ArchivaS and scanned my snapshots repository to be sure that the Archiva application would know about the artifact that was just uploaded to the snapshots repository.

Scanning snapshots repository

The "mywebapp" snapshot warW file appears in Archiva. Here, we can see the Archiva project information page for "mywebapp".

'mywebapp' deployed to Archiva snapshot repository

My finished pom.xml file is shown here.

finished 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>mywebapp</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>mywebapp Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<!-- begin - jstl dependency-->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
			<scope>provided</scope>
		</dependency>
		<!-- end - jstl dependency-->
	</dependencies>
	<build>
		<finalName>mywebapp</finalName>
		<plugins>
			<!-- begin - precompiling jsps -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jspc-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>jspc</id>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webXml>${basedir}/target/jspweb.xml</webXml>
				</configuration>
			</plugin>
			<!-- end - precompiling jsps -->
			<!-- begin - deploying/undeploying to Tomcat -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<configuration>
					<url>http://192.168.1.7:8080/manager</url>
					<server>mytomcat</server>
					<path>/mywebapp</path>
				</configuration>
			</plugin>
			<!-- end - deploying/undeploying to Tomcat -->
			<!-- begin - compiling project to a particular version of java -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<!-- end - compiling project to a particular version of java -->
			<!-- begin - setting classpath to use an Eclipse user library for Tomcat (for eclipse:eclipse) -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<classpathContainers>
						<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
						<classpathContainer>org.eclipse.jdt.USER_LIBRARY/TOMCAT_6.0.14_LIBRARY</classpathContainer>
					</classpathContainers>
				</configuration>
			</plugin>
			<!-- end - setting classpath to use an Eclipse user library for Tomcat (for eclipse:eclipse) -->
		</plugins>
		<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>
Page: < 1 2