- Add JitPack to the pom.xml. I added the following just above the dependencies tag:
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
- Add a Git commit or release of a Git repository as a dependency. In the following, we use the JGraphX project as an example. The project's Git repository is the JGraphX repository whose url is https://github.com/jgraph/jgraphx.git, from which we read that the Github username is jgraph, and the repository name is jgraphx. Browsing the project repository, we can select a commit by using its commit id (i.e., commit hash), or a tag, or a release. The JGraphX has a number releases as seen at https://github.com/jgraph/jgraphx/releases, among which is v4.0.3. Having gathered the Github username, the repository name, and the release number, we add the following as a child tag to the dependencies tag,
<dependency> <groupId>com.github.jgraph</groupId> <artifactId>jgraphx</artifactId> <version>v4.0.3</version> </dependency>
Wednesday, July 31, 2019
Adding Github Repository as a Dependecy to Java Project
I just learned that we could easily add a Github repository as a dependency to a Java project using JitPack. Below is an example to a Maven project to which we wish to add JGraphX as a dependency to the Maven project. Since JGraphX "don't properly support Maven or publish to Maven Central", this comes very handy. I view this as a two step approach:
Labels:
Computing,
Java,
Programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment