【问题标题】:Add maven dependency issue添加maven依赖问题
【发布时间】:2013-03-21 15:24:42
【问题描述】:

我想在我的 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 log发现了一个错误:

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

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

【问题讨论】:

  • 你有本地的 settings.xml 文件吗?

标签: java git maven github


【解决方案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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-21
    • 1970-01-01
    • 2017-03-24
    • 2016-03-31
    • 2021-12-06
    • 2011-10-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多