Hosting Maven Repository for third-party jars on Git (Bitbucket/Github)

Problem

Not all of the jars are in the maven central repository, or in any publicly accessible repository.

Solution

Solution bellow is somewhat outdated; for the most up to date one see this post.

Maven repository is just a collection of folders/files so could be easily hosted on git (I prefer BitBucket; but the same instructions with minor modifications are applicable to GitHub as well).  p.s. also see alternatives section towards the end.

Install jars in a local maven repository.

Make a directory e.g. maven-repo/repository

cd into maven-repo

execute the following (replacing the arguments by the ones that are relevant to your jar):

mvn install:install-file -DgroupId=com.rapid_i -DartifactId=rapidminer -Dversion=5.3.006 -Dfile=/Users/neil/Desktop/TMP/mvn1/tmp/rapidminer.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=./repository  -DcreateChecksum=true

Create a git repository (BitBucket/Github) and add jars to it

I created a repository called “maven-repo” under my username; and copied “mave-repo” folder created in a previous step and committed the changes.  (p.s.  SourceTree is awesome; if you don’t want to use command line).  Here is my public maven-repo for rapidminer.

Add repository config to your pom.xml

My pom.xml is bellow; you need to modify it to make it work for you:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.activeintel</groupId>
    <artifactId>rapidminer-proj</artifactId>
    <version>0.0.1</version> 

    <!-- Dependency to jar on Maven Repository on Git-BitBucket -->
    <dependencies>
        <dependency>
            <groupId>com.rapid_i</groupId>
            <artifactId>rapidminer</artifactId>
            <version>5.3.006</version>
        </dependency>
    </dependencies>

    <!-- Maven Repository on Git-BitBucket -->
    <repositories>
    <repository>
        <id>neil_rubens-repository</id>
        <url>https://bitbucket.org/neil_rubens/rapidminer_maven-repo/raw/master/repository/</url>
    </repository>
    </repositories>

</project>

 

Alternatives

The method outline above is mostly suitable for hosting third-party jars.  If you want to your jars on maven then this instructions are more appropriate (allows you to use mvn deploy):

http://stackoverflow.com/questions/14013644/hosting-a-maven-repository-on-github/14013645

http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/

http://synergian.github.io/wagon-git/bitbucket.html

This is an alternative of simply dragging along the jars with your project but making them usable by maven (SHOULD BE AVOIDED = MAVEN ANTI-PATTERN; ):

http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path/2230464

http://stackoverflow.com/questions/1355548/maven-including-jar-not-found-in-public-repository

 

References

This post provides nice instructions similar to mine; with my modifications including adding checksums; using BitBucket, etc.

similar posts:

http://docs.geotools.org/latest/developer/procedures/add.html

https://github.com/bixo/bixo/wiki/Adding-dependent-jars-to-the-Bixo-Maven-repository

Official guide from maven “Guide to deploying 3rd party JARs to remote repository” : http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html

Here is a post on attaching jar to artifact; although not sure how well it works in practice: http://stackoverflow.com/questions/4632648/maven-install-and-deploy-3rd-party-dependencies-with-simple-command-line

http://blog.sonatype.com/people/2008/11/adding-a-jar-to-a-maven-repository-with-sonatype-nexus/

Keywords / Search Bread crumbs:

earched for github Checksum validation failed, no checksums available from the repository 11:18pm
 
  using github as maven repository Checksum… – stackoverflow.com 11:18pm
 
  maven: “Checksum validation failed, no… – stackoverflow.com 11:20pm
 
Searched for bitbucket maven repository 11:04pm
 
  How do I release with BitBucket+Git+Maven… – stackoverflow.com – Viewed 2 times 11:04pm
 
Searched for pom.xml repository tag 11:01pm
 
  Maven – Introduction to the POM – apache.org 11:01pm
 
  maven – Should I write repositories in… – stackoverflow.com 11:01pm
 
Searched for maven deploy 10:28pm
 
  Deploy Plugin – Maven – The Apache Software… – apache.org – Viewed 2 times
Searched for maven install github 10:28pm
 
Searched for maven specify artifact jar dependency pom.xml 10:09pm
 
  Maven – Frequently Asked Technical Questions – apache.org 10:09pm
 
  Add jar-with-dependencies artifact from… – stackoverflow.com 10:09pm
 
Searched for maven specify artifact dependency pom.xml 10:08pm
 
  Maven – POM Reference – apache.org 10:08pm
 
Searched for maven specify metadata artifact dependency 10:08pm
 
  Maven Dependency plugin – Frequently… – apache.org 10:08pm
 
Searched for maven metadata artifact dependency 10:08pm
 
  maven in 5 min not working – Stack Overflow – stackoverflow.com 10:08pm
 
  maven – Could not find metadata in local… – stackoverflow.com 10:08pm
 
Searched for maven-metadata-local.xml dependency 10:06pm
 
Searched for maven dependency declaration 10:05pm
 
  Maven – Introduction to the Dependency Mechanism – apache.org 10:05pm
 
Searched for vldocking maven 9:54pm
 
  Index of /maven2repository/com/vlsolutions/vl… – sourceforge.net 9:48pm
 
  vldocking integration missing in maven?… – springsource.org 9:48pm
 
Searched for maven determine version 3rd party jar 9:52pm
 
  A Programmer’s Journal: How to manage… – blogspot.com 9:52pm
 
Searched for vldocking mvn 9:49pm
 
Searched for vldocking jar 9:47pm
 
  vldocking-3.0.0.jar – vldocking-plus… – google.com 9:48pm
 
Searched for maven determien jar version 9:47pm
 
Searched for maven jar naming convention 9:45pm
 
  Maven – Guide to Naming Conventions – apache.org 9:45pm
 
  Naming convention for Maven Artifacts… – stackoverflow.com 9:45pm
 
  Best pratices in naming conventions on… – stackoverflow.com
Searched for bitbucket maven wagon 7:22pm
 
  Chrissom – Bitbucket as a maven repository – chrissom.com 7:22pm
 
  wagon-git – github.io – Viewed 2 times 7:23pm
 
Searched for maven 3rd party jar pom.xml 7:17pm
 
  java – maven install and deploy 3rd party… – stackoverflow.com 7:14pm
 
  How to add a 3rd party jar – GeoTools… – geotools.org 7:17pm
 
  How to use Maven with a Java Application… – javacreed.com 7:17pm
 
  How to Add Third Party JARs into Maven… – skilledmonster.com 7:17pm
 
Searched for upload 3rd party jar artifact to maven 7:09pm
 
  Maven – Guide to deploying 3rd party… – apache.org 7:06pm
 
  How to Manage Maven Third Party Jars | Javalobby – dzone.com 7:09pm
 
Searched for maven upload artifact jar to github 7:03pm
 
  Hosting a Maven repository on github… – stackoverflow.com 7:03pm
 
Searched for mvn install github repository third party jar 6:55pm
 
  Adding dependent jars to the Bixo Maven… – github.com 6:55pm
 
  Maven Third Party Repo – Gists – GitHub – github.com 6:55pm
 
  How to store jars in github based maven… – stackoverflow.com 6:55pm
 
  Deploying a third party artifact to a… – robpetti.com 7:42pm
 
Searched for mvn install github repository 6:55pm
 
  Use github as maven remote repository… – rueedlinger.ch 6:52pm
 
  JakeWharton/gms-mvn-install · GitHub – github.com 6:55pm
 
  Owen Griffin – Releasing Maven projects… – owengriffin.com 6:55pm
 
  Create your own github Maven repository… – wordpress.com 6:55pm
 
  Christian Kaltepoth’s Blog – blogspot.com
Searched for maven how to host 3rd third party jars that are not in maven repository 6:45pm
 
  Deploying 3rd-party JARs to Maven Repositorie… – sonatype.com – Viewed 2 times 6:45pm
 
  Hosting my jars in Github with dependencies… – stackoverflow.com – Viewed 2 times 6:45pm
 
  java – easy way to deploy 3rd party dependenc… – stackoverflow.com 6:45pm
 
  mvn install 3rd party non-mvn jar that… – stackoverflow.com 6:45pm
 
Searched for bitbucket maven 6:33pm
 
Searched for maven add jar 6:33pm
 
Searched for Migrating from Ant maven 3 6:33pm
 
Searched for maven from build.xml 6:33pm
 
Searched for AWS SDK 6:33pm
 
Searched for aws promise activity 6:33pm
 
Searched for dataset pmml 6:33pm
 
Searched for maven-deploy-plugin 6:26pm
 
  Deploy Plugin – Maven – The Apache Software… – apache.org – Viewed 2 times 6:26pm
 
  Maven Repository: org.apache.maven.plugins… – mvnrepository.com 6:27pm
 
Searched for rapidminer maven 6:10pm
 
  IntelliJ: AWS Flow Framework (SWF) |… – activeintelligence.org – Viewed 6 times 6:11pm
 
Searched for host third party jar on maven 5:28pm
 
Searched for host thridparty jar on maven 5:27pm
 
  Deploying 3rd-party JARs to Maven Repositorie… – sonatype.com – Viewed 2 times 5:27pm
 
  Using GitHub as a personal maven repository… – coffeecoders.de 5:28pm
 
Searched for maven s3 5:18pm
 
  jcaddel/maven-s3-wagon · GitHub – github.com 5:18pm
 
  Tech Frontlines: Hosting a Maven Repository… – blogspot.com 5:18pm
 
  Jiaqi’s Blog: Publish Maven site with… – cyclopsgroup.org 5:19pm
 
  HowTo deploy to S3 using maven – Kuali… – kuali.org 5:19pm
 
  4.3 Maven Repositories, S3 and Nexus… – kuali.org
Searched for github host maven repository 5:13pm
 
  Hosting Maven Repos on Github | cemerick – cemerick.com 5:13pm
 
  Hosting my jars in Github with dependencies… – stackoverflow.com – Viewed 2 times 5:13pm
 
  Github: Deploy your own Maven repos!… – blogspot.com 5:13pm
 
  Dmitrijs Artjomenko blog: Hosting Ivy… – artjomenko.com 5:13pm
 
Searched for bitbucket maven repository 5:08pm
 
  How do I release with BitBucket+Git+Maven… – stackoverflow.com – Viewed 2 times 5:08pm
 
  Bitbucket Java Project – Jelastic – jelastic.com 5:08pm
 
  wagon-git – github.io – Viewed 2 times 5:08pm
 
Searched for bitbucket maven 1:14pm
 
Searched for maven add jar that is not in repository 1:14pm
 
Searched for maven add jar 1:14pm
 
Searched for Migrating from Ant maven 3 1:14pm
 
Searched for maven import ant build.xml 1:14pm
 
Searched for maven from build.xml
Searched for bitbucket maven 11:34pm
 
  Chrissom – Bitbucket as a maven repository – chrissom.com 11:34pm
 
  Mike’s Site: How to Publish Maven Site… – ensor.cc 11:34pm
 
Searched for github maven repository 11:32pm
 
  Hosting a Maven repository on github… – stackoverflow.com 11:32pm
 
Searched for dropbox maven 11:31pm
 
Searched for provide jar for maven repository 11:19pm
 
  Maven – Guide to installing 3rd party JARs – apache.org 11:19pm
 
Searched for maven add jar that is not in repository 11:11pm
 
  Maven: Including jar not found in public… – stackoverflow.com 11:11pm
 
  java – Adding local jars in maven project… – stackoverflow.com 11:11pm
 
  pom.xml – Maven, how to add additional… – stackoverflow.com 11:11pm
 
  How to include custom library into maven… – mkyong.com 11:11pm
 
Searched for maven add jar 11:10pm
 
Searched for maven launcher 11:04pm
 
Searched for rapidminer launcher.jar
Searched for Migrating from Ant maven 3 10:31pm
 
  Best Strategy for Migrating from Apache… – sonatype.com 10:31pm
 
  https://github.com/turn/ttorrent/pull/3 10:31pm
 
  Converting a Project from Ant to Maven… – tech-juice.org 10:31pm
 
  How to mavenize a project – Java Forums… – coderanch.com 10:32pm
 
  Migrating a Project from Ant to Maven… – safaribooksonline.com 10:32pm
 
Searched for maven import ant build.xml 10:27pm
 
  Maven 1.x – Migrating from Ant – apache.org 10:27pm
 
Searched for maven from build.xml
Searched for launcher rapidminer vldocking 10:12pm
 
Searched for launder rapidminer vldocking 10:12pm
 
Searched for ant to maven3 10:08pm
 
Searched for ant to maven 10:08pm
 
  How can I replace Ant with Maven? – Stack… – stackoverflow.com 10:08pm
 
  Hildeberto’s Blog: Case Study: Migrating… – hildeberto.com 10:08pm
 
Searched for maven from ant 10:07pm
 
Searched for convert ant to maven intellij 10:02pm
 
  Creating and importing Maven projects… – jetbrains.net – Viewed 7 times 10:02pm
 
  IntelliJ – Convert a Java project/module… – stackoverflow.com 10:02pm
 
  How to convert maven java project to… – howtodoinjava.com 10:02pm
 
  IntelliJ IDEA :: Ant and Maven support… – jetbrains.com
Searched for convert ant to maven 10:01pm
 
  How to convert from Ant to Maven in 5… – sonatype.com 10:02pm
 
  How to convert Ant project to Maven project… – stackoverflow.com 10:02pm
 
Searched for javafx xml file 9:57pm
 
Searched for rapidminer maven 9:50pm
 
  Features for RapidMiner 5.0 – rapid-i.com 9:50pm
 
Searched for rapidminer beans 9:46pm
 
  Get some Coffee for free – Writing… – uni-dortmund.de 9:46pm
 
Searched for rapidminer pom.xml 9:44pm
 
  dm2e-rapidminer/pom.xml at master ·… – github.com 9:44pm
 
  https://bitbucket.org/cbockermann/rapidminer-… 9:44pm
 
Searched for maven rapidminer 9:43pm
 
  How can I prevent Rapidminer from initializin… – rapid-i.com 9:43pm
 
  https://bitbucket.org/cbockermann/rapidminer-… 9:44pm
 
  IntelliJ: AWS Flow Framework (SWF) |… – activeintelligence.org – Viewed 6 times

 

 

 

 

 

About Neil Rubens

see http://ActiveIntelligence.org
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Hosting Maven Repository for third-party jars on Git (Bitbucket/Github)

  1. Pingback: Maven accessing private repository on bitbucket | Stackforum

Leave a Reply

Your email address will not be published. Required fields are marked *


*