In my previous article I wrote, we went through a step by step process of creating a GitHub account and hosting our Maven artifact on it. In this article, I will show you how to use that artifact we hosted on GitHub as a dependency in a new maven project.
At this stage i take it as you already have your artifact already hosted on GitHub. If not, you can follow this article to learn how to do so.
Steps to how to use GitHub hosted Maven artifact in a Maven Project
Create a new Maven Java Application. I will be using NetBeans for this tutorial.
4.0.0
com.mycompany
TestMaven
1.0-SNAPSHOT
jar
UTF-8
1.7
1.7
Now in your POM, we have to specify where our GitHuB repository is and also all dependencies. To do so, edit the xml below and paste after the closing properties tag.
{GIT-USERNAME}
{NAME-OF-GIT-REPOSITORY}
{GIT-REPOSITORY-URL}
{GROUP-ID-OF-ARTIFACT}
{NAME-OF-ARTIFACT}
{VERSION-NUMBER}
compile
In my case, this should be
4.0.0
org.jpedalh
TestMaven
1.0-SNAPSHOT
jar
UTF-8
1.7
1.7
moshhasa
maven-test-repo
https://github.com/moshhasa/maven-test-repo/raw/master/
org.jpedal
FooBar
1.0
compile
Now save the Pom file and do a Clean and Build on your project. You should see Maven downloading your artifact from GitHub.This will me saved in your local repository.
Our software libraries allow you to
Convert PDF to HTML in Java |
Convert PDF Forms to HTML5 in Java |
Convert PDF Documents to an image in Java |
Work with PDF Documents in Java |
Read and Write AVIF, HEIC, WEBP and other image formats |