Answer the question
In order to leave comments, you need to log in
How to add dependencies from a git repository in Java?
Hello! I'm new to java and can't google how to download the dependency from github. Java has maven, sbt, gradle, and so on, but I didn’t see an example in them where you can simply specify a link to a git turnip and download it. In PHP, the composer simply specified the project name, version, and a link to the repository, and you're done. How about in java?
Answer the question
In order to leave comments, you need to log in
1) Create a Maven project
2) Open the pom.xml
file
By default, the content of the file is something like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.test</groupId>
<artifactId>test.a</artifactId>
<packaging>war</packaging>
<version>1</version>
<name>name-project</name>
</project>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo name</artifactId>
<version>Release tag</version>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.test</groupId>
<artifactId>test.a</artifactId>
<packaging>war</packaging>
<version>1</version>
<name>name-project</name>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo name</artifactId>
<version>Release tag</version>
</dependency>
</dependencies>
</project>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question