Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Using a Maven Repository on Kenai

DZone's Guide to

Using a Maven Repository on Kenai

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

One of the missing things on Kenai is a Maven repository. I mean, an "official" Maven repository managed by Kenai staff. This doesn't mean you can't create your own repository on Kenai. Peter Mount explains ( part one, part two) how you can just create a Maven repository as a Subversion site - in his latter post, Peter shows how to automatically perform a deploy by using Hudson, with some script trickery.

But, thanks to the wagon-svn maven plugin, it is possible to do that directly with Maven. The plugin implements a Maven extension making it able to deploy to any Subversion-based repository (actually, it has been developed for Java.Net, that has got such a repository).

So, I've just created a Tidalwave project on Kenai, that I'll use for hosting some common facilities for all my projects, then I added a Subversion repository named "tidalwave~maven-repo". To deploy to that repository, a pom needs the following elements:

    <repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>maven2-repository.tidalwave.kenai.com</id>
<name>Tidalwave Maven Repository</name>
<url>svn:https://kenai.com/svn/tidalwave~maven-repo/2</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>

<build>

<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
<artifactId>wagon-svn</artifactId>
<version>1.8</version>
</extension>
</extensions>
...
<build>



The declaration of the Java.Net repository is used to find the wagon-svn plugin, that takes care of target repositories whose URL starts with svn:.

The first time you do a mvn deploy, the computer will ask for the username and password of the target repository; after you set once, they will be remembered in the Subversion preferences, so this thing will also work with Hudson.

You can check out a very small Maven project using my new brand Maven repository from here: https://kenai.com/svn/thesefoolishthings~svn/trunk/src - TheseFoolishThings is a collection of tiny libraries (mostly made by a single file) for functions that so far I used to copy & paste in different projects, and that now I'm refactoring.

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}