【问题】Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only
最新推荐文章于 2024-06-04 12:00:45 发布
最新推荐文章于 2024-06-04 12:00:45 发布 阅读量 3.3k

在编译某开源项目(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.

在使用maven工具进行项目打包时,报出了下面的错误: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 3.1:compile (default-compile) on project cloud-api-commons: Fatal error compiling 二、解决办法 我的jdk是1.8,下面以jdk1.8进行讲解 首先,我创建的是一个springboot项目,一个父工程中包含. 一般eclipse 4之后的版本都会有maven插件这时我们就不用再下载Maven插件了,但当运行maven的Pom.xml文件时会出现下列错误: [INFO] Scanning for projects... [INFO]                                                                          [INFO] ---- Maven报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile之解决方法 Maven deploy 报错: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:deploy (default-deploy) on project Failed to retrieve remote metadata /maven-metadata.xml: Could not transfer met... 最近又遇到一个小问题,那就是maven在install的时候报这个错误,我检查了一下在maven中有这个插件:maven-compiler-plugin:3.1 但是在idea中就是在控制台报错,install不成功。 在这里有两个路子,首先去idea中打开,settings -> build,Execution —> compiler -->java compiler Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project cloud-api-commons: Fatal error compiling 这个错误的话,是由于你项目所需jdk版本和你当前使用的jdk版本不一致导致的,把idea中的所有的配置统一版本,我的idea中run这个项目却是1.8的 1.Setting... 背景:本项目使用JDK1.8 编译maven工程的时候出现如下错误: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1 pom中如下配置maven插件,配置中声明使用JDK1.8: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin< 把maven项目打包到本地仓库时,出现此错误:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project 001-link-provider: Compilation failure 原因:项目需要的JDK版本号和使用的JDK版本号不一致所致 解决办法:把使用的JDK版本号和项目所需的版本号改为一致即可 如把项目所需JDK版本号改为使用的JDK版本