How to setup your google code repository to be accessible in maven

This tutorial will teach us how we can setup a google code project, so we can make the artifact accessible via maven.

Requirements:
1.) You should have an account in google code.

The trick is just simply forming the correct url to be access by maven.

For example I have a google code account:
http://czetsuya.googlecode.com

Steps:
1.) In your pom.xml file add the following repository:
<repository>
<id>czetsuya-repo</id>
<name>czetsuya-repo</name>
<url>http://czetsuya.googlecode.com/svn/maven2/</url>
</repository>

2.) Notice the suffix at the end of the url: svn/maven2? That means we need to create that directory in google code, Source tab->Browse.

3.) Inside svn/maven2, create the folder depending on your specification, example org/czetsuya/maven/demo/1.0.0. Note that 1.0.0 is the version number.

4.) Upload your jar and pom file inside the folder. pom file should contain the project information.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.czetsuya</groupId>
<artifactId>maven-demo</artifactId>
<version>1.0.0</version>
</project>

5.) To use the artifact you need to add the dependency like:
<dependency>
<groupId>com.czetsuya</groupId>
<artifactId>maven-demo</artifactId>
<version>1.0.0</version>
</dependency>

0 nhận xét:

Đăng nhận xét