2

我想在我的 pom.xml 中添加一个依赖项以从 github 存储库中签出一个库。

我的 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 日志发现了一个错误:

[错误] 无法在项目测试器上执行目标:无法解析项目 com.nvtien.test:tester:jar:0.0.1-SNAPSHOT 的依赖项:github.com/cemerick/cemerick-mvn-repo/snapshots 缓存在本地存储库,在更新之前不会重新尝试解析 -> [帮助 1]

我的问题是:怎么了?为什么 maven 不能下载 codequality-1.0.4.jar ?

4

1 回答 1

1

请添加以下存储库:

<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>
于 2013-03-31T11:24:34.080 回答