GitHub dependency in Apache Maven project

I have a Maven project on github.com:

<project ...> ... <groupId>com.example</groupId> <artifactId>my-github-library</artifactId> <packaging>jar</packaging> <version>1.0.0</version> ... </project> 

Now I want to add my-github library as a dependency on another project of my local application:

 <project ...> ... <groupId>com.example</groupId> <artifactId>my-local-application</artifactId> <packaging>jar</packaging> <version>1.0.0</version> ... <dependencies> ... <dependency> <groupId>com.example</groupId> <artifactId>my-github-library</artifactId> <version>1.0.0</version> </dependency> ... </dependencies> ... </project> 

This, of course, does not work, because GitHub is not a Maven repository.

How to add an additional Maven repository to a project pom file?

+4
source share
1 answer

You can request open source hosting for your Github project artifacts from the Sonatype OSS team . Then you will need to configure the project for deployment in your repository (using <distributionManagement/> in pom.xml and <servers/> in settings.xml ). After you deploy the artifact that you depend on, you can make your other project depend on it using <dependency/> and define <repository> in the <repositories/> section pointing to your repo in Sonatype.

+1
source

All Articles