我想在我的 pom.xml 中添加一个依赖项以从 github 存储库中 check out 一个库。
我的 pom 文件是:
<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>com.nvtien.test</groupId>
<artifactId>tester</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.levonk</groupId>
<artifactId>codequality</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>cemerick-snapshots</id>
<url>https://raw.github.com/cemerick/cemerick-mvn-repo/snapshots</url>
</repository>
</repositories></project>
这里是 github 仓库:
https://github.com/levonk/pub-maven-repo
我的本地 ~m2/settings.xml
<servers>
<server>
<id>github</id>
<username>XXXX</username>
<password>XXXX</password>
</server></servers>
而且我通过maven日志发现了一个错误:
[ERROR] Failed to execute goal on project tester: Could not resolve dependencies for project com.nvtien.test:tester:jar:0.0.1-SNAPSHOT: github.com/cemerick/cemerick-mvn-repo/snapshots was cached in the local repository, resolution will not be reattempted until the update -> [Help 1]
我的问题是:出了什么问题?为什么 maven 无法下载 codequality-1.0.4.jar?
最佳答案
请添加以下存储库:
<repository>
<id>https-levonk</id>
<url>https://github.com/levonk/pub-maven-repo/tree/master/release/</url>
</repository>
顺便说一句,我发现那里只有 1.0.8(和 1.0.9)版本。
https://github.com/levonk/pub-maven-repo/tree/master/release/com/levonk/codequality
请添加以下依赖项,它将为您工作:
<dependency>
<groupId>com.levonk</groupId>
<artifactId>codequality</artifactId>
<version>1.0.8</version>
</dependency>
关于java - 添加maven依赖问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15728446/