Maven使用错误的存储库下载 [英] Maven uses wrong repository to download
问题描述
我使用的是com.sun.jersey-server/json/client的旧版本(1.5),因此必须是该版本,因此请勿建议使用较新的版本.
I am using a bit older version (1.5) of com.sun.jersey-server/json/client and it has to be this version so please don't suggest to use a newer version.
在我的pom.xml中,我通过以下方式引用它:
In my pom.xml I am referencing it with:
<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>
编译使此输出出现错误:
Compiling gives this output with error:
[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首先出现在这里:
After searching for a solution, I added this repository to my pom so maven looks there first:
<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存储库下载它.
But that didn't do anything. I deleted the .m2/jersey
folder and tried mvn clean compile
again. It still tries to download it from the glassfish-404 repository.
有人知道我必须更改什么才能正确下载吗?
Does anyone know what I have to change so it will download properly?
推荐答案
尝试先添加Maven Central的存储库:
Try to add repository of the maven central before others:
<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/
Better option would be setting up of the nexus server and getting rid of repository sections in pom files: http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/
这篇关于Maven使用错误的存储库下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!