2013-03-31 96 views
2

我想在我的pom.xml中添加一个依赖项来检出github库中的libray。添加maven依赖项问题

我的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 

我的地方〜2/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被缓存在本地存储库中,分辨率将不会被重新尝试,直到更新 →[Help 1]

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

+0

你本地settings.xml文件? –

回答

1

请添加以下库:

<repository> 
    <id>https-levonk</id> 
    <url>https://github.com/levonk/pub-maven-repo/tree/master/release/</url> 
</repository> 

BTW,我发现那里只有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>