首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >maven依赖项未解析

maven依赖项未解析
EN

Stack Overflow用户
提问于 2013-09-14 00:36:53
回答 2查看 4.2K关注 0票数 0

我有以下依赖项:

代码语言:javascript
复制
    <dependency>
      <groupId>ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.6.5-osgi</version>
    </dependency>

它在maven中央存储库中不可用。我可以选择哪个镜像来正确解决它(在本地安装并部署到我们的内部存储库)?

更新我从答案中看到,我需要添加一些细节。这种依赖关系在我们的任何pom中都没有显式设置。当调用maven install时,会因为找不到它而失败。我发布了完整的堆栈:

代码语言:javascript
复制
    [ERROR] Failed to execute goal on project XXXXXX-functional-test: Could not resolve
    dependencies for project XXXXXX-functional-test:jar:2.16.1: Failed to collect dependencies
    for [org.codehaus.groovy:groovy-all:jar:1.7.2 (test), sahi:sahi:jar:3.5 (test), 
    org.easyb:easyb-core:jar:1.1 (test), org.apache.httpcomponents:httpclient:jar:4.1.1 (test), 
    commons-io:commons-io:jar:1.4 (test), org.aspectj:aspectjrt:jar:1.6.8 (compile), 
    org.springframework.integration:spring-integration-sftp:jar:2.0.5.RELEASE (compile), 
    org.springframework.integration:spring-integration-core:jar:2.0.5.RELEASE (compile), 
    org.springframework:spring-dao:jar:1.2.5 (test), junit:junit:jar:4.8.2 (test), 
    org.mockito:mockito-all:jar:1.8.5 (test), mysql:mysql-connector-java:jar:5.1.13 (provided), 
    com.oracle:ojdbc6:jar:11.2.0.1.0 (provided), log4j:log4j:jar:1.2.16 (compile), 
    org.springframework:spring-context:jar:3.0.5.RELEASE (test), org.springframework:spring-
    context-support:jar:3.0.5.RELEASE (compile), org.springframework.integration:spring-
    integration-mail:jar:2.0.0.M4 (compile), org.springframework:spring-test:jar:3.0.5.RELEASE 
    (test)]: Failed to read artifact descriptor for ant:ant:jar:1.6.5-osgi: Could not transfer 
    artifact ant:ant:pom:1.6.5-osgi from/to nexus 
    (http://ournexusaddress:8081/nexus/content/groups/public): Checksum validation failed, could 
    not read expected checksum: C:\Users\andrea\.m2\repository\ant\ant\1.6.5-osgi\ant-1.6.5-
    osgi.pom.sha1.tmp56e90fe6eda74ac3 (The system cannot find the file specified) -> [Help 1]

此时,我使用-e、-X和以下选项运行mvn:

代码语言:javascript
复制
    Caused by: org.sonatype.aether.transfer.ChecksumFailureException: Checksum validation failed,        
     could not read expected checksum: C:\Users\andrea\.m2\repository\ant\ant\1.6.5-osgi\ant-
    1.6.5-osgi.pom.sha1.tmp56e90fe6eda74ac3 (The system cannot find the file 
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.verifyChecksum(WagonRepositoryConnector.java:714)

at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:618)
... 4 more
Caused by: java.io.FileNotFoundException: C:\Users\andrea\.m2\repository\ant\ant\1.6.5-osgi\ant-1.6.5-osgi.pom.sha1.tmp56e90fe6eda74ac3 (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at org.sonatype.aether.util.ChecksumUtils.read(ChecksumUtils.java:47)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.verifyChecksum(WagonRepositoryConnector.java:710)
    ... 5 more

[ERROR] 
[ERROR] 

出于这个原因,我试着看看我是否能找到问题顶部给出的pom。我还添加了显式调用的依赖项。

代码语言:javascript
复制
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>1.7.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>sahi</groupId>
        <artifactId>sahi</artifactId>
        <version>3.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easyb</groupId>
        <artifactId>easyb-core</artifactId>
        <version>1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.4</version>
        <scope>test</scope>
    </dependency>

目前作为一种变通方法,我在我们的CI构建服务器(构建是绿色的:-)的本地maven存储库中发现了一个未损坏的版本。osgi和我会把它上传到nexus.

EN

回答 2

Stack Overflow用户

发布于 2013-09-14 00:41:00

http://mirrors.ibiblio.org/maven2/上提供了镜像

或者尝试

代码语言:javascript
复制
<dependency>
    <groupId>ant</groupId>
    <artifactId>ant.osgi</artifactId>
    <version>1.6.5</version>
</dependency>

最新版本

代码语言:javascript
复制
<dependency>
    <groupId>ant</groupId>
    <artifactId>ant</artifactId>
    <version>1.7.0</version>
</dependency>

Apache ivy maven配置

代码语言:javascript
复制
<dependency>
    <groupId>org.apache.ivy</groupId>
    <artifactId>ivy</artifactId>
    <version>2.1.0</version>
</dependency>
票数 1
EN

Stack Overflow用户

发布于 2013-09-14 00:41:19

代码语言:javascript
复制
<dependency>
  <groupId>ant</groupId>
  <artifactId>ant</artifactId>
  <version>1.6.5-osgi</version>
  <type>pom</type>// remove this 
</dependency>

并尝试

代码语言:javascript
复制
 <dependency>
  <groupId>ant</groupId>
  <artifactId>ant</artifactId>
  <version>1.6.5</version>      
</dependency>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18791176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档