Siddesh BG's Build Release Config mgmt Blog

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 8 June 2012

Deploying maven build artifacts to Nexus repository

Posted on 02:41 by Unknown
To deploy the artifacts generated by your maven build to nexus repository, you need configure it in 2 files
1) Parent pom.xml
2) settings.xml

and also to prevent publishing password in settings.xml file, you need to configure password less ssh connection between your build machine and nexus repository


Pom.xml changes
Add distributionManagement section to your parent pom.xml and provide ID, name, url for various delivery types like snapshots, releases, site, etc.
Here is an example from our project




<distributionManagement>
   <repository>
<id>kms.distribution.releaserepository</id>
<name>DPM KMS Maven Release Repository</name>
<url>scp://my-repo.org/export/nexus/sonatype-work/nexus/storage/releases/</url>
<uniqueVersion>false</uniqueVersion>
   </repository>
   <snapshotRepository>
<id>kms.distribution.snapshotrepository</id>
<name>DPM KMS Maven Snapshot Repository</name>
<url>scp:// my-repo.org /export/nexus/sonatype-work/nexus/storage/snapshots/</url>
<uniqueVersion>false</uniqueVersion>
   </snapshotRepository>
           <site> 
            <id>kms.distribution.sitelocation</id>
            <name>DPM Maven Site location</name>
            <url>scp:// my-repo.org /export/nexus/sonatype-work/nexus/storage/rkm/site/</url> 
            </site>
</distributionManagement>

The above configuration dictates to copy kits using scp. There are other ways of delivering like http.
Also we created ID's like kms.distribution.releaserepository, kms.distribution.snapshotrepository, etc. The related entries needs to be made in settings.xml file

settings.xml changes
The settings.xml for a maven2 project can reside either in
1) ~/.m2/settings.xml or
2) MAVEN-INSTALLATION-LOCATION/conf/settings.xml

In settings .xml file add  <servers> tag and provide login credentials for nexus repository.

 <servers>

   <server>
        <id>kms.distribution.snapshotrepository</id>
        <username>maven</username>
    </server>
    <server>
        <id>kms.distribution.releaserepository</id>
        <username>maven</username>
    </server>
    <server>
        <id>kms.distribution.sitelocation</id>
        <username>maven</username>
    </server>

  </servers>


You can provide password using <password> tag. But it's not wise to share password in settings.xml.
Instead establish a password less ssh connection between your build server and nexus repo using public/private key generation.


After making above changes, run
mvn depoloy

which will deploy your artifacts in nexus repository.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in maven | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Solution to Project Euler Problem 10 - Find the sum of all the primes below two million
    http://projecteuler.net/problem=10 Problem The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two mi...
  • Installing and configuring Fortify on Linux and Windows machines
    Installing Fortify on Linux (RHEL 5 32 bit) Download Fortify archive Fortify-360-2.6.5-Analyzers_and_Apps-Linux-x86.tar.gz and extract it to...
  • FeatureBranch v/s FeatureToggle v/s BranchByAbstraction patterns
    This blog is excerpts from Martin Fowler blog and Continuous Delivery book (Jez Humble, David Farley). It explains about the concepts of 1) ...
  • How to know architecture of a AIX machine?
    We can easily know the architecture type in Linux or Solaris systems with the help of "uname" command. But uname command in AIX do...
  • How to know a Unix/Linux system is a 32/64 bit architecture?
    To know whether given Unix/Linux machine is of type 32/64 bit architecure, use the command getconf LONG_BIT It outputs correspondingly 32 or...
  • 0509-036 Cannot load program ssh because of the following errors: Dependent module /usr/local/ssl/lib/libcrypto.a(libcrypto.so) could not be loaded.
    I installed openssh without any problem, but when I invoked either ssh/sshd, it started giving error .. > ssh exec(): 0509-036 Cannot loa...
  • AIX: make: 1254-055 Dependency line needs colon or double
    We get this compilation issue "make: 1254-055 Dependency line needs colon or double" while compiling C/C++ code in AIX machines. I...
  • Perforce branch locking
    You can lock Perforce branch,depot or any other folder by using either 1) Protection table 2) Triggers Using protection table: You can lock ...
  • 0509-036 Cannot load program p4 because of the following errors
    Here is the full description of error ............ bash-3.00# p4 info exec(): 0509-036 Cannot load program p4 because of the following error...
  • How to increase open files limit in Linux. Fix for java.io.FileNotFoundException (Too many open files) error
    I was configuring a new build on Linux machine and it kept on failing with error java.io.FileNotFoundException : /home/build/jenkins/workspa...

Categories

  • AIX
  • AIX ssh
  • ANT
  • apache
  • appliance
  • awk
  • branching
  • build-failures
  • cgi-perl
  • code-signing
  • commands
  • continuous Integration
  • cvs
  • cygwin
  • DNS
  • Drupal
  • EPM
  • euler
  • Fortify
  • hadoop
  • hpux
  • html
  • InstallShield
  • iptables
  • iso
  • jenkins-hudson
  • Jira
  • kiwi
  • linux
  • Makefile
  • maven
  • Miscellaneous
  • mysql
  • nexus
  • NFS
  • package
  • Perforce
  • Perl
  • php
  • rbuilder
  • rpath
  • rpm
  • rsync
  • Solaris
  • ssh
  • SuseStudio
  • tinderbox
  • unix
  • Visual studio 2008
  • vmware
  • war
  • webserver
  • wget
  • windows
  • xterm

Blog Archive

  • ►  2013 (12)
    • ►  December (1)
    • ►  July (2)
    • ►  April (2)
    • ►  March (2)
    • ►  February (3)
    • ►  January (2)
  • ▼  2012 (43)
    • ►  December (2)
    • ►  November (1)
    • ►  October (4)
    • ►  September (7)
    • ►  August (5)
    • ►  July (4)
    • ▼  June (2)
      • rsync - Syncing soft-link's as soft-link
      • Deploying maven build artifacts to Nexus repository
    • ►  May (3)
    • ►  April (4)
    • ►  March (3)
    • ►  February (1)
    • ►  January (7)
  • ►  2011 (23)
    • ►  December (4)
    • ►  November (9)
    • ►  October (4)
    • ►  September (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
  • ►  2010 (15)
    • ►  December (2)
    • ►  November (1)
    • ►  September (3)
    • ►  April (1)
    • ►  February (6)
    • ►  January (2)
  • ►  2009 (28)
    • ►  November (5)
    • ►  October (3)
    • ►  September (2)
    • ►  August (1)
    • ►  July (1)
    • ►  June (5)
    • ►  May (3)
    • ►  April (1)
    • ►  February (2)
    • ►  January (5)
  • ►  2008 (20)
    • ►  December (6)
    • ►  November (3)
    • ►  October (1)
    • ►  September (1)
    • ►  July (8)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile