对于ImmutableList,Maven构建失败并出现ClassNotFoundException

时间:2017-05-29 08:36:02

标签: maven

当我在我的mac机器上进行maven构建时。我收到了com.google.common.collect.ImmutableList的ClassNotFoundException。

Vizzy-MacBook-Pro:puppet-common vizzy$ mci -X
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T02:28:10+05:30)
Maven home: /Users/vizzy/Software/apache-maven-3.2.3
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

异常

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList
    at com.google.inject.internal.Errors.<clinit>(Errors.java:655)
    at com.google.inject.internal.InternalInjectorCreator.<init>(InternalInjectorCreator.java:62)
    at com.google.inject.Guice.createInjector(Guice.java:96)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:477)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:203)
    at org.apache.maven.cli.MavenCli.container(MavenCli.java:398)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:208)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    ... 18 more

我尝试过在一个新的maven仓库中建造,但仍然遇到同样的问题。

1 个答案:

答案 0 :(得分:0)

我将maven版本更改为3.5.0并且构建正常。它还可以在3.0.5版本上构建。 不确定为什么这个问题是在maven版本3.2.3中引起的。