【问题】Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only

问题

在编译某开源项目(openLooKeng)时出现异常,导致编译失败。

异常内容

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only (default) on project presto-vv: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only (default) on project presto-vv: Dependency problems found
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    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:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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: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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
    at org.apache.maven.plugins.dependency.analyze.AbstractAnalyzeMojo.execute (AbstractAnalyzeMojo.java:253)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    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:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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: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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

原因及解决方法

这是由于开启了maven的依赖检查插件,插件检查时发现某些依赖没有用到或者用到了但是未定义的问题。如下:

[INFO] --- maven-dependency-plugin:3.1.1:analyze-only (default) @ presto-vv ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.apache.pulsar:pulsar-client-api:jar:2.8.0:compile
[WARNING]    org.apache.pulsar:pulsar-metadata:jar:2.8.0:compile
[WARNING]    commons-configuration:commons-configuration:jar:1.10:compile
[WARNING]    org.apache.bookkeeper:bookkeeper-common:jar:4.14.1:compile
[WARNING]    org.slf4j:slf4j-api:jar:1.7.29:compile
[WARNING]    javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[WARNING]    org.apache.commons:commons-lang3:jar:3.11:compile
[WARNING]    org.jctools:jctools-core:jar:2.1.2:compile
[WARNING]    org.apache.bookkeeper:bookkeeper-server:jar:4.14.1:compile
[WARNING]    org.apache.pulsar:pulsar-client-admin-api:jar:2.8.0:compile
[WARNING]    org.apache.pulsar:pulsar-common:jar:2.8.0:compile
[WARNING]    org.apache.avro:avro:jar:1.9.2:compile
[WARNING]    io.netty:netty-buffer:jar:4.1.63.Final:compile
[WARNING]    org.apache.bookkeeper.stats:bookkeeper-stats-api:jar:4.14.1:compile
[WARNING] Unused declared dependencies found:
[WARNING]    org.projectlombok:lombok:jar:RELEASE:compile

如果不需要严格检查无效依赖,可以通过参数设置不检查。该插件的具体解释参考:
maven-dependency-plugin -> analyze-only

跳过该检查需要添加的参数:skip,解释如下:
Skip plugin execution completely.
Default value is: false.
User property is: mdep.analyze.skip.

你可能感兴趣的:(Java,Maven,maven,apache,java)