Skip to content

Instantly share code, notes, and snippets.

@daluu
Last active May 11, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daluu/dda7b29cb5b6e0fbfbaec664eb759739 to your computer and use it in GitHub Desktop.
Save daluu/dda7b29cb5b6e0fbfbaec664eb759739 to your computer and use it in GitHub Desktop.
Custom/additional maven repos to get some not so common maven hosted JARs

Just an example for others and a note for myself in case I need to reference this in the future.

Steps:

Add the custom/additional maven repos where you can find the JARs (that are not hosted on maven central or other common repo)

<repositories>
   <!-- has some useful JARs not hosted on maven central, a popular alternative repo -->
   <repository>
     <id>clojars.org</id>
     <url>http://clojars.org/repo</url>
   </repository>
   <!-- needed for javaxt/javaxt-core dependency -->
   <!-- this repo has version 1.6.2 -->
   <repository>
     <id>jspresso.org</id>
     <url>http://repository.jspresso.org/maven2</url>
   </repository>
   <!-- this repo has version 1.4.3 -->
   <repository>
     <id>ci-dev.renci.org</id>
     <url>http://ci-dev.renci.org/nexus/content/repositories/public</url>
   </repository>
</repositories>

Then put in the JAR dependencies. For not so common JARs where there's no webpage that shows you what POM XML entry to put in, you'll need to browse the maven repo via web browser and find the file maven-metadata.xml for your desired JAR, then get the values for groupId, artifactId, and desired version for the JAR you want and create a entry for your POM file like follows:

<dependencies>
   <dependency>
     <groupId>javaxt</groupId>
     <artifactId>javaxt-core</artifactId>
     <version>1.6.2</version>
   </dependency>
 </dependencies>

Then test out by running a maven command to pull the JARs, and verify your desired JAR is saved to your local maven repo.

And if there's issue with these public repos, one can go the alternate route of maven repo self hosting, as in this example using source control with local repo as an alternate maven repo to pull JARs from (where you first download and store the JARs in said repo): https://gist.github.com/daluu/52af7eef52563ddf78fe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment