Can I use a GitHub project directly in Maven?

JavaMavenGithub

Java Problem Overview


I am interested in using a https://github.com/toelen/spymemcached-jcache">project on GitHub as a dependency in my project. The GitHub project has a pom file. Can I modify my pom file to use this project? If so, how? If not, what is my best course of action?

Java Solutions


Solution 1 - Java

Try jitpack, you just need to add the dependency, jitpack will build others for you.

From home page: >jitpack
>Easy to use package repository for Gradle and Maven projects
>JitPack builds GitHub projects on demand and provides ready-to-use packages

HOW

  1. Add repository first

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

2. Add dependency

<dependency>
    <groupId>com.github.User</groupId>
    <artifactId>Repo name</artifactId>
    <version>Release tag</version>
</dependency>

TIPS:

You can see its build log too https://jitpack.io/com/github/NanoHttpd/nanohttpd/Release-2.1.0/build.log

Solution 2 - Java

Not in the way I think you mean, AFAIK.

You can use github as a Maven repository--this is not the same thing as directly referencing a project, and that it has a pom file means only that it's a Maven project.

If the project is not available in the central, or other, repository, your best bet may be to clone it, build it, and install it locally. You should confirm that it's truly not available elsewhere.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBjorn RocheView Question on Stackoverflow
Solution 1 - JavawenerView Answer on Stackoverflow
Solution 2 - JavaDave NewtonView Answer on Stackoverflow