gpt4 book ai didi

maven - Maven使用错误的存储库下载

转载 作者:行者123 更新时间:2023-12-03 13:56:26 25 4
gpt4 key购买 nike

我使用的是com.sun.jersey-server / json / client的旧版本(1.5),它必须是此版本,所以请不要建议使用较新的版本。

在我的pom.xml中,我引用了以下内容:



    <dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.5</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<!-- version conflicts with explicit direct dependency -->
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</exclusion>
</exclusions>
</dependency>


编译使此输出出现错误:

    [INFO] Scanning for projects...
[INFO]------------------------------------------------------------------------
[INFO] Building MediaAssistantWebService
[INFO] task-segment: [clean, install]
[INFO]------------------------------------------------------------------------
[...]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
Downloading: http://repositories.dai-labor.de/extern/content/repositories/dai-open/com/sun/jersey/jersey-server/1.5/jersey-server-1.5.pom
[INFO] Unable to find resource 'com.sun.jersey:jersey-server:pom:1.5' in repository dai-open (http://repositories.dai-labor.de/extern/content/repositories/dai-open)
Downloading: http://download.java.net/maven/2//com/sun/jersey/jersey-server/1.5/jersey-server-1.5.pom 10K downloaded (jersey-server-1.5.pom)
Downloading: http://maven.glassfish.org/content/groups/glassfish/com/sun/jersey/jersey-project/1.5/jersey-project-1.5.pom 185b downloaded (jersey-project-1.5.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html><head><title>301' - RETRYING
Downloading: http://maven.glassfish.org/content/groups/glassfish/com/sun/jersey/jersey-project/1.5/jersey-project-1.5.pom185b downloaded (jersey-project-1.5.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html><head><title>301' - IGNORING
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: null:jersey-server:bundle:null

Reason: Cannot find parent: com.sun.jersey:jersey-project for project: null:jersey-server:bundle:null for project null:jersey-server:bundle:null


在寻找解决方案之后,我将此存储库添加到了pom中,因此maven首先出现在那里:

<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>


但这没有任何作用。我删除了 .m2/jersey文件夹,然后再次尝试了 mvn clean compile。它仍然尝试从glassfish-404存储库下载它。

有人知道我必须更改什么才能正确下载吗?

最佳答案

尝试先添加Maven Central的存储库:



<repositories>
<repository>
<id>maven-central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
...
</repositories>


更好的选择是设置nexus服务器并摆脱pom文件中的存储库部分:
http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/

关于maven - Maven使用错误的存储库下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11689953/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com