Using Nexus as Proxy for corporate Open Source project

The problem when working on an Open Source project which is hosted on a consortium (OW2 in our case) is that the users and developers community which are not working in the same organization than you must be able to compile your project without the help of your Maven2 proxy…

The current article will focus on how to use Sonatype Nexus on the corporate side and how to deliver your independant Open Source project. I will not speak about how to use Nexus as artifact repository here (will probably come in another post).

1. Always define repositories in your project POMs
This is because the community must be able to compile all without any proxy. It is quite important to give IDs to each repository and to keep the ID list in mind…
For example, here is the OW2 Release repository definition :

		<repository>
			<id>ow2.release</id>
			<name>OW2 Repo</name>
			<url>http://maven.ow2.org/maven2</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

2. Give the list of repositories to proxify
2.1 Add the repository to Nexus
Ask your Nexus administrator to add the repositories you want to proxify to Nexus (this is not part of this blog entry, refer to the Nexus guide which is quite complete for that).

2.2 Define the list in your local settings.xml file
In the settings.xml file located under $HOME/.m2/, you must define the list of repository IDs you want to be handled by your Nexus Proxy:

<mirror>
<id>nexus</id>
<name>Nexus Mirror</name>
<url>http://m2proxy:8081/nexus/content/groups/public/</url>
<mirrorOf>central,ow2.release,ow2-plugin.release,ow2-plugin</mirrorOf>
</mirror>

This configuration will say to the Maven engine that all the calls to the 4 repositories (‘central,ow2.release,ow2-plugin.release,ow2-plugin’) will be forwarded to the corporate Nexus proxy running on http://m2proxy:8081.

Following this procedure, you will be able to compile your project with AND without the proxy but the proxy will really optimize your compilation time.

Une réflexion sur “Using Nexus as Proxy for corporate Open Source project

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s