Java.lang.NoSuchMethodError:'com.google.common.base.Preconditions.checkArgument(boolean,无效)

2022-04-05 00:00:00 java maven pom.xml guava

清理MVN时出现以下错误

xxxxxx@mxxxxx:~/test/toto$ mvn clean
---------------------------------------------------
Exception in thread "main" java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object)'
    at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:341)
    at com.google.inject.Key.strategyFor(Key.java:335)
    at com.google.inject.Key.get(Key.java:219)
    at org.eclipse.sisu.wire.ParameterKeys.<clinit>(ParameterKeys.java:28)
    at org.eclipse.sisu.wire.DependencyAnalyzer.<init>(DependencyAnalyzer.java:93)
    at org.eclipse.sisu.wire.ElementAnalyzer.<init>(ElementAnalyzer.java:104)
    at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:74)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
    at com.google.inject.spi.Elements.getElements(Elements.java:103)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:69)
    at com.google.inject.Guice.createInjector(Guice.java:59)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:206)
    at org.apache.maven.cli.MavenCli.container(MavenCli.java:636)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:282)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

我认为问题在于番石榴版本仍然在guava-19.0.jar上。我已将

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>30.1.1-jre</version>
    </dependency>
在pom.xml中,但我无法下载它,因为MVN已损坏 有谁知道吗?谢谢


解决方案

我找到了解决方案,只需卸载/安装maven

sudo apt-get purge --auto-remove maven
sudo apt install maven

相关文章