当前位置: 首页 > 知识库问答 >
问题:

Maven将commons-collections groupid解析为org.apache.commons.collections,并且找不到版本3.2.1

长孙星汉
2023-03-14

在我的pom中,我有一个依赖项:

<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.1</version>
</dependency>

IMHO这是正确的依赖关系(比较http://mvn repository . com/artifact/commons-collections/commons-collections/3 . 2 . 1)。

但是,当Maven尝试解决此问题时,它尝试的URL是:

Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo1.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
[WARNING] The POM for org.apache.commons:commons-collections:jar:3.2.1 is missing, no dependency information available
Downloading: http://almvn.solnetsolutions.co.nz/content/groups/public/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://almvn.solnetsolutions.co.nz/content/repositories/releases/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo1.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar

这些都失败了,因为(恕我直言)它是错误的组ID(org/apache/公共资源)。它从哪里获得URL路径中的“org/apache/公共资源”?

我没有其他依赖项会在组id中提到org.apache。

Maven从哪里获得此网址?

这是如此错误,为什么它不能正确地解决它:http://central.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

?

我的Maven设置是:

Apache Maven 3.0.4 (r1232337; 2012-01-17 21:44:56+1300)
Maven home: /home/solnet/apache-maven-3.0.4
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: /home/solnet/jdk1.7.0_11/jre
Default locale: en_NZ, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.2.1.el6.x86_64", arch: "amd64", family: "unix"

这是我在pom文件中的存储库设置:

    <repositories>

        <repository>
            <id>mvnrepo</id>
            <name>mvnrepo</name>
            <url>http://mvnrepository.com</url>
        </repository>

         <repository>
            <id>centralmvn</id>
            <name>centralmvn</name>
            <url>http://central.maven.org</url>
        </repository>
        <repository>
            <id>mvnrepo2</id>
            <name>mvnrepo2</name>
            <url>http://repo1.maven.org</url>
        </repository>
        <repository>
            <id>oss-sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>codehaus-snaphosts</id>
            <name>Codehaus Snapshots</name>
            <url>http://snapshots.repository.codehaus.org/</url>
        </repository>
        <repository>
            <id>codehaus-releases</id>
            <name>CodeHaus Releases</name>
            <url>http://repository.codehaus.org/</url>
        </repository>

   /repositories>

这是输出的"mvn帮助:有效的pom"…

这是

mvn依赖:tree-Dincludes=“org.apache.commons:commons集合

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mobilewebapp 1.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://almvn.solnetsolutions.co.nz/content/groups/public/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://almvn.solnetsolutions.co.nz/content/repositories/releases/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
[WARNING] The POM for org.apache.commons:commons-collections:jar:3.2.1 is missing, no dependency information available
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.986s
[INFO] Finished at: Thu Sep 04 11:28:24 NZST 2014
[INFO] Final Memory: 9M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mobilewebapp: Could not resolve dependencies for project nz.co.nzlotteries:mobilewebapp:war:1.1.0-SNAPSHOT: Could not find artifact org.apache.commons:commons-collections:jar:3.2.1 in mvnrepo (http://mvnrepository.com) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

共有2个答案

高恺
2023-03-14

好吧,最后这个问题的真正答案实际上是:我有另一个依赖项目,这个项目也有错误的groupid。因此,当Maven构建项目时,它使用依赖项的pom来解析jar。

所以我基本上遇到了一个级联问题,我只能从底部开始解决问题,而不是从顶部开始。

感谢所有提供的帮助!

鲁龙野
2023-03-14

您配置了无效的存储库,要修复它,请更改

 类似资料:
  • 我正在阅读这些文档,仍然不知道Maven是如何决定下载哪些版本的插件的。 例如,考虑以下简单场景: 一个空的本地存储库 默认settings.xml 运行一个简单的maven命令。例如,用于,如Maven在5分钟文档中所述。 运行命令后,Maven做的第一件事就是下载一堆插件。 Maven正在下载的一些插件包括: maven-clean-plugin-2.4.1 maven-install-plu

  • 我已经在构建中包含了这个依赖项。gradle与mavencentral回购。 当我做Gradle依赖时,gradle找不到这个依赖。这是输出。 编译-源集“main”的依赖项(已弃用,请改用“实现”)。

  • 问题内容: 我正在尝试使用Mongoid / DeviseRails3.1模板(Mongoid_和Devise),并且不断收到错误消息,指出ExecJS无法找到JavaScript运行时。当我没有安装任何东西时,这还算公平,但是我尝试安装Node.js,Mustang和RubyRacer,但是没有任何效果。 我找不到JavaScript运行时。有关可用运行时的列表,请参见sstephenson /

  • 我使用的是open JDK15,也用了11,没有任何更改 有什么建议吗?

  • 问题内容: 我们公司最近从Windows XP升级到Windows 7 Enterprise。JDK安装不再将 user.home 设置为用户目录的完整路径,而是将user.home设置为。这导致诸如Eclipse,Maven等应用程序出现很多问题。我现在必须在JVM中为每个应用程序设置- Duser.home。其他人有没有经历过?有解决办法吗?这与Windows 7 Enterprise的安装有

  • 我无法理解为什么当我通过的文本符合格式时,我会得到DateTimeParseException错误。下面是导致该问题的代码: 奇怪的是。每当我查询用户一段时间(让我们以00:02:30为例),它就会完全按照我想要的方式运行。但是当我使用我的方法(从文本文件中提取时间)时,它会出现错误: 线程“main”java.time.format.DateTimeParseException中出现异常:无法分