3

We have a JAVA library in our private github repository. We want to include this library into other JAVA projects as maven dependency. I am looking for a way to successfully host a maven repository inside my private github repo.

I am able to successfully host the maven repo by following the steps mentioned here. However, I am unable to link this repo as a dependency in my other projects.

In an answer to another question here, someone has mentioned that this is not possible anymore. But I am able to point to this repo when I make this repo public. This leads me to believe that maven is not using the credentials specified in ~/.m2/settings.xml while resolving the dependencies.

I somehow also believe that github is not supporting download of binary files hosted in private repo using basic http authentication. While I can successfully do

curl -uazitabh https://github.com/azitabh/test/raw/mvn-repo/test-1/test-1/0.0.11/test-1-0.0.11.jar

Doing the following results in {"error":"Not Found"}

curl -uazitabh https://github.com/ANOTHER-USER/test/raw/mvn-repo/test-1/test-1/0.0.11/test-1-0.0.11.jar

Permissions are alright as I can very well download the jar file using the same link in the browser when I am logged in.

How to get the dependency resolution bit working?

Community
  • 1
  • 1
azi
  • 929
  • 1
  • 11
  • 31
  • 1
    Why not using a repository manager like Nexus, Artifactory or Achiva? Makes it easier. Apart from that a dependency is an artifact and *not* a URL in Maven. – khmarbaise Oct 13 '14 at 15:52
  • 1
    @khmarbaise: that's coz i don't want to pay extra for what i think should be doable using my paid github account.. i obviously don't want to make my repo public. and yes, a dependency i think eventually points to a url that can be formed using repo-url, groupId, artifactId and version.. for e.g: http://repo1.maven.org/maven2/com/google/code/maven-play-plugin/net/tanesha/recaptcha4j/recaptcha4j/0.0.8/recaptcha4j-0.0.8-sources.jar is a url for version 0.0.8 of a dependency named recaptcha4j having group id com.google.code.maven-play-plugin.net.tanesha.recaptcha4j hosted at repo1.maven.org/maven2 – azi Oct 13 '14 at 18:52
  • it obviously has a certain directory structure, what i am trying to demonstrate in the question is that the jar file can't be downloaded using basic http auth... whereas it's possible to download the same thing when the repo in public – azi Oct 13 '14 at 18:55
  • You don't need to pay for Nexus OSS / Artifact OSS / Archiva. And it has nothing to do to make your repository public. You can go on the other hand via bintray. – khmarbaise Oct 14 '14 at 07:05

0 Answers0