Thursday, February 7, 2013

[Github / Maven] Maven repository using GitHub

This simple post is a reminder on how to create a Maven2 repository and use it with Maven in a "pom.xml" file or in Java Play!.

The first step is to create a GitHub Repository (it will be named "maven2").

Then reproduce the folder structure of a Maven Repository, as I did in my "Maven2" repo (

For instance, given this artifact (jar):

  <name>Official Evernote API</name>

Create these folders:


Now you have a pubblicly accessible Maven2 repository at[username]/[repoName]/raw/master/ (in my case

To consume it in your projects, just add this lines in the "pom.xml" file of your project:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" 
 . . .
 . . .

To integrate the maven repo in a Java Play! project (necessary if you're messing with Heroku), take the "/prject/Build.scala" file and add those lines:

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "evernote-integration"
    val appVersion      = "0.1"

    val appDependencies = Seq(
      "com.rubenlaguna" % "evernote-api" % "1.22", //Evernote Thrift Library
      "com.rubenlaguna" % "libthrift" % "1.0-SNAPSHOT",//Thrift core library
      "postgresql" % "postgresql" % "9.1-901.jdbc4", //Postgres
      "org.apache.httpcomponents" % "fluent-hc" % "4.2.1" //Apache HTTP client

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
     resolvers+= "personal maven repo" at ""


Maven will search for the selected jars in the default locations, but when it's not finding anything it will search for your personal resolvers.