简体   繁体   English

无法在Eclipse(Luna)Maven中安装任何新库

[英]Cannot install any new libraries in Eclipse (Luna) Maven

This error just started appearing, with any new maven dependencies I install. 这个错误刚刚开始出现,我安装了任何新的maven依赖项。 The dependency shows up in the Maven dependencies tree empty, and the project reports, for example: 依赖关系在Maven依赖关系树中显示为空,并且项目报告,例如:

Description Resource Path Location Type Archive for required library: '~/.m2/repository/com/ning/async-http-client/1.8.14/async-http-client-1.8.14.jar' in project 'LB' cannot be read or is not a valid ZIP file LB Build path Build Path Problem

I viewed the POM file for each new dependency, and they all have this in them: 我查看了每个新依赖项的POM文件,它们都包含在内:

<HTML>
<BODY>
This repo has moved to repo.boundlessgeo.com. Please update your settings.
</BODY>
</HTML>

So i discovered that the OpenGeo Maven Repo has moved, based on this: 所以我发现OpenGeo Maven Repo在此基础上发生了变化:

<!-- <repository>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <id>opengeo</id>
    <name>OpenGeo Maven Repo</name>
    <url>http://repo.opengeo.org</url>
</repository> -->

Replaced with this: 替换为:

<repository>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <id>boundless</id>
    <name>Boundless Maven Repository</name>
    <url>http://repo.boundlessgeo.com/main</url>
</repository>

Even though I fixed this issue, all other dependencies still fail to install. 即使我修复了这个问题,所有其他依赖项仍然无法安装。 Any idea why the POM files for any other repo keep getting the HTML notice from OpenGeo? 知道为什么任何其他repo的POM文件不断从OpenGeo获取HTML通知? How can I fix? 我该怎么办?


Here's the entire repo section of my pom.xml 这是我的pom.xml的整个repo部分

<repositories>
<repository>
    <id>maven2-repository.dev.java.net</id>
    <name>Java.net repo</name>
    <url>http://download.java.net/maven/2</url>
</repository>
<repository>
    <id>osgeo</id>
    <name>Open Source Geospatial Foundation Repo</name>
    <url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <id>opengeo</id>
    <name>OpenGeo Maven Repo</name>
    <url>http://repo.opengeo.org</url>
</repository>
<repository>
    <id>central</id>
    <name>The Central Repository</name>
    <url>http://repo1.maven.org/maven2/</url>
</repository>

Updated answer: 更新的答案:

If you have a repository defined in your pom.xml which provides static content instead of a proper Maven repository (in this case http://repo.opengeo.org , which has moved to http://repo.boundlessgeo.org ), Maven will download the static content as the pom, jar, etc and complain about it being corrupted later. 如果您在pom.xml中定义了一个存储库,该存储库提供静态内容而不是正确的Maven存储库(在本例中为http://repo.opengeo.org ,已移至http://repo.boundlessgeo.org ), Maven将下载静态内容作为pom,jar等,并抱怨它在以后被破坏。 These invalid files will remain in your local repository until you delete them, even after you fix the problem repository . 即使在修复问题存储库之后,这些无效文件仍会保留在本地存储库中,直到您将其删除为止

The simplest way to get rid of the invalid files would be to delete your entire ~/.m2/repository and download all artifacts fresh. 摆脱无效文件的最简单方法是删除整个〜/ .m2 /存储库并下载所有新文件。 However, you can also just delete the problem files (adjust the grepped message according to the static content in your invalid files): 但是,您也可以删除问题文件(根据无效文件中的静态内容调整grepped消息):

grep -lrIZ "This repo has moved to repo.boundlessgeo.com" ~/.m2/repository \
  | xargs -r0 rm

Then do a normal mvn clean install and valid artifacts should be downloaded from the corrected repository. 然后执行正常的mvn clean install并从更正的存储库下载有效的工件。

See the original question for details on updating http://repo.opengeo.org to http://repo.boundlessgeo.org . 有关将http://repo.opengeo.org更新到http://repo.boundlessgeo.org的详细信息,请参阅原始问题。

Note: Maven is likely downloading the invalid static content because repo.opengeo.org is returning a status code of 200. 注意:Maven可能会下载无效的静态内容,因为repo.opengeo.org返回的状态代码为200。


Original answer: 原始答案:

Is it possible that you've somehow configured the old OpenGeo Maven Repo to be a mirror for all respositories? 您是否有可能以某种方式将旧的OpenGeo Maven Repo配置为所有存储库的镜像? Maybe in your local settings.xml, or in a Nexus artifact repository? 也许在您的本地settings.xml或Nexus工件库中?

I ran into something similar, where our Nexus server somehow had a bunch of non-OpenGeo artifacts in our proxied OpenGeo repository. 我碰到了类似的东西,我们的Nexus服务器在代理的OpenGeo存储库中以某种方式有一堆非OpenGeo工件。 Once the OpenGeo/BoundlessGeo repo moved, I got the "This repo has moved" message until I deleted the non-OpenGeo artifacts from the proxy repository. 一旦OpenGeo / BoundlessGeo repo移动,我得到了“此repo已移动”消息,直到我从代理存储库中删除了非OpenGeo工件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM