Maven 3.0.4 NoSuchMethod:... java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSet.copyOf(..)

2023-12-22

我已经安装了Maven 3.0.4 with Homebrew每当我运行mvn命令我得到以下信息:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableSet;

从谷歌搜索错误来看,它似乎与某种相关谷歌番石榴工具/库——对此我一无所知。我尝试更换一些罐子/bin的目录maven但没有影响

有什么帮助吗?我不知道问题从哪里开始,但现在我无法运行任何东西mvn.

这似乎是一个相关的问题,但我的项目没有直接引用guava*.jar file:

NoSuchMethod 获取 gdata 服务时出错 https://stackoverflow.com/questions/9222665/nosuchmethod-error-getting-a-gdata-service

这是完整的 mvn -X (我在当前目录中使用 pom.xml 运行)

    Jordans-iMac:spring-mvc-setup jordanbaucke$ mvn -X
Apache Maven 3.0.4 (r1232337; 2012-01-17 01:44:56-0700)
Maven home: /usr/local/Cellar/maven/3.0.4/libexec
Java version: 1.7.0_09, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"
---------------------------------------------------
constituent[0]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/aether-api-1.13.1.jar
constituent[1]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/aether-connector-wagon-1.13.1.jar
constituent[2]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/aether-impl-1.13.1.jar
constituent[3]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/aether-spi-1.13.1.jar
constituent[4]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/aether-util-1.13.1.jar
constituent[5]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/commons-cli-1.2.jar
constituent[6]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-aether-provider-3.0.4.jar
constituent[7]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-artifact-3.0.4.jar
constituent[8]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-compat-3.0.4.jar
constituent[9]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-core-3.0.4.jar
constituent[10]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-embedder-3.0.4.jar
constituent[11]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-model-3.0.4.jar
constituent[12]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-model-builder-3.0.4.jar
constituent[13]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-plugin-api-3.0.4.jar
constituent[14]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-repository-metadata-3.0.4.jar
constituent[15]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-settings-3.0.4.jar
constituent[16]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/maven-settings-builder-3.0.4.jar
constituent[17]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/plexus-cipher-1.7.jar
constituent[18]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/plexus-component-annotations-1.5.5.jar
constituent[19]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/plexus-interpolation-1.14.jar
constituent[20]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/plexus-sec-dispatcher-1.3.jar
constituent[21]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/plexus-utils-2.0.6.jar
constituent[22]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/sisu-guava-0.9.9.jar
constituent[23]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/sisu-guice-3.1.0-no_aop.jar
constituent[24]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/sisu-inject-bean-2.3.0.jar
constituent[25]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/sisu-inject-plexus-2.3.0.jar
constituent[26]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/wagon-file-2.2.jar
constituent[27]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/wagon-http-2.2-shaded.jar
constituent[28]: file:/usr/local/Cellar/maven/3.0.4/libexec/lib/wagon-provider-api-2.2.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableSet;
    at com.google.inject.internal.InstanceBindingImpl.<init>(InstanceBindingImpl.java:51)
    at com.google.inject.internal.BindingBuilder.toInstance(BindingBuilder.java:95)
    at com.google.inject.internal.InjectorShell$RootModule.configure(InjectorShell.java:329)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
    at com.google.inject.spi.Elements.getElements(Elements.java:103)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
    at com.google.inject.Guice.createInjector(Guice.java:94)
    at com.google.inject.Guice.createInjector(Guice.java:71)
    at com.google.inject.Guice.createInjector(Guice.java:61)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:196)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:160)
    at org.apache.maven.cli.MavenCli.container(MavenCli.java:375)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:191)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Update

降级到Java 1.6,同时卸载Macports。同样的问题。


问题是 MAVEN_HOME 变量设置错误,因为它指向错误的文件夹

Maven home: /usr/local/Cellar/maven/3.0.4/libexec

此外,您使用的安装看起来不像 maven.apache.org 下载页面的默认安装。

您应该下载Apache-maven-3.0.4-bin.tar.gz http://archive.apache.org/dist/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz从 maven.apache.org 解压它并将 MAVEN_HOME 指向提取的存档的根目录,如下所示:

/usr/local/apache-maven-3.0.4

并将 bin 文件夹 /usr/local/apache-maven-3.0.4/bin 放入 PATH 中。如果你打电话

mvn --version

应该打印出或多或少类似于以下内容的内容:

mac:~ km$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: /usr/share/maven
Java version: 1.6.0_26, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.5.8", arch: "x86_64", family: "mac"
mac:~ km$ 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Maven 3.0.4 NoSuchMethod:... java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSet.copyOf(..) 的相关文章

随机推荐

  • 未找到 APOC 程序

    CALL apoc export csv query match m Movie where m name Matrix return m name re sults csv 错误 Neo ClientError Procedure Pro
  • Python-camelot(安装时错误:GhostscriptNotFound)

    我正在尝试使用camelot从pdf中提取表格数据 但出现以下错误 Code tables camelot read pdf file name Error GhostscriptNotFound 请确保 Ghostscript 已安装并且
  • Azure 中的 Serilog 与 API 应用程序

    我已将 Serilog 集成到使用 Asp Net Core 2 0 开发的 WebApi 项目中 这是配置代码Program cs Log Logger new LoggerConfiguration Enrich FromLogCont
  • 将字符串转换为 C# 中的控件名称[重复]

    这个问题在这里已经有答案了 可能的重复 按名称在 C winforms 中查找控件 https stackoverflow com questions 4483912 find a control in c sharp winforms b
  • 找到两个向量之间的最佳/缩放/移位

    我有两个向量表示函数 f x 另一个向量 f ax b 即 f x 的缩放和移位版本 我想找到最好的规模和转变因素 最佳 通过最小二乘误差 最大似然等 有任何想法吗 例如 f1 0 0 450541598502498 0 083821377
  • 输入后忽略回车键的C代码

    我遇到了标准输入流中的 Enter 键或字符弄乱以下输入调用的问题 假设我有一个输入调用 所以我输入了内容 但随后将 Enter 键作为下一个输入调用的输入 我认为在c 中有cin ignore 来做到这一点 我就是找不到C版本 输入法有g
  • 如何在VBA中保存工作表

    我正在构建一个表单 当您填写该表单时 它应该生成 2 个文件作为输出 为了做到这一点 我在后台有 2 张纸 我根据用户输入的按钮将其保存 作为 csv 来填充 这是保存工作表的代码 Worksheets worksheetname Save
  • 带彩色输出的工头运行防护装置

    我可以从我的工头 procfile 中运行守卫 但输出并不像我想要的那样丰富多彩 我在输出中看到的唯一颜色来自 Foreman 我想要一个管理 rspec 黄瓜和茉莉花的保护文件 并且在这些测试运行时有漂亮的颜色输出 看起来好像工头忽略了防
  • 为什么 Magento 每个会话使用 2 个 cookie?

    出于数据安全和隐私原因 我想知道为什么 Magento 对一个前端会话使用两个 cookie 我所知道的是其中一个正在被设置Mage Core Model Cookie set 另一个在Zend Session expireSessionC
  • HTML & XHTML id 属性问题

    id 属性值可以以数字开头吗 对于 HTML 没有 http www w3 org TR html401 types html type name http www w3 org TR html401 types html type nam
  • 安卓中的人脸识别

    我需要在 Android 4 0 的应用程序中实现人脸识别登录 由于 Android Ice Cream Sandwich 中提供了人脸识别解锁功能 是否有任何开放的 SDK 或内置库来实现此功能 到目前为止 我遇到过外部 API 例如ht
  • Jenkins 管道 sh returnsstdout 不工作

    我正在尝试使用 Jenkins pipeline sh 命令的 returnStdout 功能 此处定义https jenkins io doc pipeline steps workflow durable task step code
  • JAR 文件:为什么提取然后压缩 JAR 文件会创建与原始大小不同的文件?

    我试图编辑提取的 Eclipse 插件 jar 文件中的单个字节 我注意到 在我将文件重新压缩为 jar 后 生成的文件比原始文件大 仅 1 并且该插件不起作用 Eclipse 已启动 但在选择工作区后静默关闭 回滚到原来的插件可以让它成功
  • 删除 index.php 并处理两个 Codeigniter 站点的子域(当其中一个站点位于另一个站点时)

    我有两个 Codeigniter 站点 一个位于另一个站点的子目录中 我需要一些帮助来修改我的 htaccess 文件以从两者中删除 index php 第一个站点 http subdomain domain com存储在 home sit
  • 将 2D 数组传递给 C++ 函数

    我有一个函数 我想将可变大小的二维数组作为参数 到目前为止我有这个 void myFunction double myArray myArray x y 5 etc 我在代码中的其他地方声明了一个数组 double anArray 10 1
  • 使用裁剪工具进行图像裁剪的 Django 应用程序

    我需要一个在客户端裁剪图像的应用程序 我的意思是 使用像 Jcrop jquery 插件这样的裁剪工具 我找到了这个工具 django 图像裁剪器 https github com marazmiki django image croppe
  • CUDA/PTX 32 位与 64 位

    CUDA 编译器可以选择生成 32 位或 64 位 PTX 这些有什么区别呢 是不是像 x86 一样 NVidia GPU 实际上也有 32 位和 64 位 ISA 还是仅与主机代码有关 指针肯定是最明显的区别 http docs nvid
  • NanoHTTPD - 将 https 流转换为 http

    为了克服 Chromecast 对来自自认证 https 服务器 在我的例子中是 Subsonic 音乐服务器 进行流传输的限制 我正在利用已经作为我的 Android 应用程序的一部分运行的 NanoHTTPD 服务器实例 这个想法是从
  • 如何在 Dart 中将 RxInt 转换为 Int ||扑?

    我正在玩扑扑 我遇到错误并且没有得到任何正确的解决方案 在我的应用程序中 我有一些可观察的变量GetX https pub dev packages get控制器 当尝试应用某种格式然后在此处获取日志时 Exception caught b
  • Maven 3.0.4 NoSuchMethod:... java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSet.copyOf(..)

    我已经安装了Maven 3 0 4 with Homebrew每当我运行mvn命令我得到以下信息 Exception in thread main java lang NoSuchMethodError com google common