Search code examples
mavendeploymentpom.xmlarchiva

Deploy an artifact into Archiva repo using maven POM


I am trying to deploy a specific artifact I have developed to Archiva using the POM file for my project.

I have added the artifact as a dependency in the POM file. I'm not 100% clear on how that 'should be done but I have the following since the kar's name is CNS0103_0.1.kar

<dependency> <groupId>kar</groupId> <artifactId>CNS0103_0.1</artifactId> <version>0.1</version> </dependency

What else do I need to add to this POM? The artifact's repository?


Solution

  • Here's what I add to my pom.xml if I want to deploy the artifact to my Maven repo:

    <distributionManagement>
        <repository>
            <id>internal</id>
            <url>http://HOST:PORT/archiva/repository/internal/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Archiva Managed Snapshot Repository</name>
            <url>http://HOST:PORT/archiva/repository/snapshots/</url>
            <layout>default</layout>
        </snapshotRepository>
    </distributionManagement>
    
    <repositories>
        <repository>
            <id>snapshots</id>
            <url>http://HOST:PORT/archiva/repository/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>