Ernest Duodu Ernest is a Java developer. Outside programming, he also enjoys a wide variety of hobbies which includes sky-diving, photography, exercising and listening to music.

Are you a Java Developer working with PDF files?

Find out why you should be using JPedal

How to use GitHub hosted Maven artifact in NetBeans IDE

1 min read

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.

Screen Shot 2015-06-03 at 10.46.54
Give it a Project Name, Group Id and Version, click here to learn more about Maven projects I will call mine TestMven and leave the rest as default.

Screen Shot 2015-06-03 at 11.17.31
Once done, right click on the project and select Open POM. You should see something like this.



    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.

Screen Shot 2015-06-03 at 11.46.48
Once done, Open the Dependencies folder in the Projects view and you should see the jar added to your project.

Screen Shot 2015-06-03 at 11.51.55
Now Test Your Dependency.

Screen Shot 2015-06-03 at 12.45.42
Hopefully you have found this quick guide useful. In my next article i will show you how I converted the Ant NetBeans Plugin to Maven Plugin



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
Ernest Duodu Ernest is a Java developer. Outside programming, he also enjoys a wide variety of hobbies which includes sky-diving, photography, exercising and listening to music.