Saturday, March 27, 2010

Build and Deploy to Maven2 Repo

OGCE components use Maven2 for build and Archiva for repository management. For legacy reasons some dependencies are exist in extreme lab maven repository. To upgrade these components and release a version and deploy a jar file to extreme lab maven 2 repository, add the following distributionManagement tag to the pom.xml.

<distributionmanagement>
<repository>
<uniqueversion>false</uniqueversion>
<id>xRepo</id>
<name>Extreme Lab Repository</name>
<url>scp://mneme.extreme.indiana.edu/l/extreme/java/repository</url>
<layout>default</layout>
</repository>
</distributionmanagement>

mvn deploy will deploy the generated jar files to the repository but will prompt to enter the password and will also assume local account name. To avoid password prompt and to specify a different user name the following settings.xml can be placed in the $HOME/.m2 directory. For security reasons, never include the settings.xml in any of the packages, this file should be protected by file system security and is strongly advised to set the file permissions to 600.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xsi="http://www.w3.org/2001/XMLSchema-instance" schemalocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>xRepo</id>
<username>smarru</username>
<privatekey>${user.home}/.ssh/id_dsa</privatekey> <!-- if ssh keys are not available the password can be set as <password>my_password</password> -->
<passphrase>some_passphrase</passphrase>
<filepermissions>664</filepermissions>
<directorypermissions>775</directorypermissions>
<configuration></configuration>
</server>
</servers>
</settings>

No comments: