DEV Community

Cheav Sovannarith
Cheav Sovannarith

Posted on • Originally published at Medium on

Loading Maven dependencies from GitHub

jitpack.io — github.com

Now you can import a Java library from a GitHub repo using JitPack.

In your pom.xml:

First Add repository:



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


Enter fullscreen mode Exit fullscreen mode

Second Add dependency:



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


Enter fullscreen mode Exit fullscreen mode

Note : for release tag

Before we can use release tag as a version in dependency, we have to create release tag first.



$ git tag -a 0.0.1-SNAPSHOT -m "commit message"
$ git push origin --tag


Enter fullscreen mode Exit fullscreen mode

*READ MORE * : https://git-scm.com/book/en/v2/Git-Basics-Tagging

Example : I have a Repository : https://github.com/sovannarithcheav/artifact-demo.git, So the dependency should look like this :



<dependency>
 <groupId>com.github.sovannarithcheav</groupId>
 <artifactId>artifact-demo</artifactId>
 <version>0.0.1-SNAPSHOT</version>
</dependency>


Enter fullscreen mode Exit fullscreen mode

It’s easy, right? 😜

READ MORE : loading-maven-dependencies-from-github


Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post