maven\java.lang.NoClassDefoundError:com/google/public/base/Strings

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (210)

我正在编译maven java项目,但没有找到Guava依赖项下,以下为报错:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Strings
        at org.sonatype.nexus.maven.staging.deploy.DeployLifecycleParticipant.getPluginByGAFromContainer(DeployLifecycleParticipant.java:239)
        at org.sonatype.nexus.maven.staging.deploy.DeployLifecycleParticipant.getNexusMavenPluginFromContainer(DeployLifecycleParticipant.java:183)
        at org.sonatype.nexus.maven.staging.deploy.DeployLifecycleParticipant.getBuildPluginsNexusMavenPlugin(DeployLifecycleParticipant.java:164)
        at org.sonatype.nexus.maven.staging.deploy.DeployLifecycleParticipant.afterProjectsRead(DeployLifecycleParticipant.java:96)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:264)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
        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:497)
        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.base.Strings
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 18 more

My Pom File

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>18.0</version>
</dependency>
                <dependency>
                        <groupId>org.apache.nifi</groupId>
                        <artifactId>nifi-api</artifactId>
                </dependency>

                <dependency>
                        <groupId>com.fasterxml.jackson.dataformat</groupId>
                        <artifactId>jackson-dataformat-csv</artifactId>
                        <version>2.7.3</version>
                </dependency>

                <dependency>
                        <groupId>org.apache.nifi</groupId>
                        <artifactId>nifi-processor-utils</artifactId>
                        <version>1.1.0</version>
                </dependency>
                <dependency>
                        <groupId>commons-codec</groupId>
                        <artifactId>commons-codec</artifactId>
                        <version>1.10</version>
                </dependency>

                <dependency>
                        <groupId>com.fasterxml.jackson.dataformat</groupId>
                        <artifactId>jackson-dataformat-xml</artifactId>
                        <version>2.7.3</version>
                </dependency>

                <dependency>
                        <groupId>org.apache.commons</groupId>
                        <artifactId>commons-csv</artifactId>
                        <version>1.4</version>
                </dependency>




                <dependency>
                        <groupId>org.apache.nifi</groupId>
                        <artifactId>nifi-utils</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.apache.nifi</groupId>
                        <artifactId>nifi-mock</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-simple</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <scope>test</scope>
                </dependency>
        </dependencies>


        <build>
                <sourceDirectory>src</sourceDirectory>
                        <plugins>
                        <plugin>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>3.5.1</version>
                                <configuration>
                                        <source>1.8</source>
                                        <target>1.8</target>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
提问于
用户回答回答于

扫码关注云+社区

领取腾讯云代金券