Tuesday, September 30, 2008

Using HTTP-based Subversion Repository for Local Maven 2 Repository

Maven 2 repository could be exposed to public using several protocols. The protocol will be reflected by how we access the repository. The popular ones are HTTP, HTTPS, Subversion, and of course direct file system access which should be reflected by URIs:
  • http://repo1.maven.org/maven2
  • https://localmaven.jugi.or.id
  • svn://kutukupret
  • file:///opt/maven2/repo
Subversion which is a source code management (SCM) software could also be exposed to public through HTTP/HTTPS protocol. 

Because most developers should have at least read only access to the source code base of the SCM software, any SCM software that is exposed through HTTP/HTTPS protocol could be easily tuned to be Maven 2 local repository as well. I will show the way to use SCM as Maven 2 repository using Subversion  but the principles will apply to any HTTP/HTTPS based SCMs.

Here is how we do it.

When you look to Maven 2 repositories such as http://repo1.maven.org/maven2, the structure is quite simple.
Grab the example the resource specified in this URL: 

We need to break down this URL into these fields:
  • artifactId: openjpa
  • groupId: org.apache.openjpa
  • version: 1.2.0
  • Maven 2 repository root URL: http://repo1.maven.org/maven2/



No comments:

Post a Comment