MichaBa
MichaBa

Reputation: 485

maven automatically deploy artifacts on Archiva?

Maybe the question is asked for more than hundred times, but I didn't find it with the search function.

Ok we've a CI Server running Jenkins and Archiva. Building our code with maven. But now our IT Department changed the proxy configuration for the CI Server. It isn't able to go online.

When I use a new artifact and build it locally, mvn downloads this and stores it in the local repo.

But when I commit the sourcecode in the SVN Jenkins fails, caused of the missing internet connection.

So is there a way to automatic deploy artifacts and maven-plugins to Archiva when I build my projects local with maven?

Upvotes: 2

Views: 3295

Answers (2)

Jet
Jet

Reputation: 661

I created a Jenkins job that will execute a shell script to ask Maven to deploy our private artifact in Archiva

Prerequisites

In your .m2/settings.xml file add your server, i.e.

<server>
    <id>archiva.release</id>
    <username>admin</username>
    <password>123456</password>
</server>

Deploy 3rd party artifacts to archiva repository shell script

            #!/bin/bash

            rm_host=localhost       # archiva server address
            rm_port=8080            # archiva port
            major_version=1     #
            minor_version=0     #
            version_build=1     #
            repository=private      # your repository id in archiva

            mvn deploy:deploy-file
                -Dfile=myApp.jar
                -DgroupId=com.company
                -DartifactId=myApp
                -Dversion=${major_version}.${minor_version}.${version_build}
                -Dpackaging=jar
                -Durl=http://${rm_host}:${rm_port}/repository/${repository}/ -DrepositoryId=archiva.release

Upvotes: 0

Olivier Lamy
Olivier Lamy

Reputation: 2310

use mvn clean deploy that will deploy to Archiva. You have to configure correctly distributionManagement section in your pom. See http://archiva.apache.org/docs/1.4-M4/userguide/deploy.html

Upvotes: 1

Related Questions