我已经安装Maven 3.0.4
了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
文件:
获取 gdata 服务时出现 NoSuchMethod 错误
这是完整的 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)
更新
降级到 Java 1.6,同时卸载 Macports。同样的问题。