Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin

2023-10-29 11:50

本文主要是介绍Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

idea编译项目时,出现如下报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (validate) on project devops-brain: Failed during checkstyle configuration: Cannot set property 'cacheFile' to 'F:\Copote\Code\devops-brain\devops-brain\target/checkstyle-cachefile': InvocationTargetException: com/google/common/io/Flushables: com.google.common.io.Flushables -> [Help 1]

 进入pom.xml所在目录,如图:

执行如下命令,查看详细日志:

mvn clean package -e -X
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (validate) on project devops-brain: Failed during checkstyle configuration: Cannot set property 'cacheFile' to 'target/c
achefile': InvocationTargetException: com/google/common/io/Flushables: com.google.common.io.Flushables -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (validate) on project devops-brain: Failed during checkstyle configurati
onat org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)...at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed during checkstyle configurationat org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo.execute (CheckstyleViolationCheckMojo.java:534)...at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'cacheFile' to 'target/cachefile'at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty (AutomaticBean.java:237)at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure (AutomaticBean.java:191)...at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.reflect.InvocationTargetExceptionat sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)...at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NoClassDefFoundError: com/google/common/io/Flushablesat com.puppycrawl.tools.checkstyle.PropertyCacheFile.flushAndCloseOutStream (PropertyCacheFile.java:167)...
Caused by: java.lang.ClassNotFoundException: com.google.common.io.Flushablesat org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)...at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[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

定位到日志:

Caused by: java.lang.ClassNotFoundException: com.google.common.io.Flushables

这个类在如下依赖jar包中,在pom中添加如下依赖:

<dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>20.0</version>
</dependency>

如果依赖引入后还不行,请删除本地maven库中guava目录,重新导入: 

重新编译项目,如果没其他错误,即可成功。不幸的是,作者编译后继续报错如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (validate) on project devops-brain-manager-bean: Failed during checkstyle execution: There are 8 errors reported by Checkstyle 8.18 with ../../code-style/checkstyle.xml ruleset. -> [Help 1]
 

继续执行如下命令,查看详细日志:

mvn clean package -e -X

如图:

[INFO] 寮?濮嬫鏌モ?︹??
[ERROR] F:\Copote\Code\...\dto\AlertRuleDto.java:7:4: 鏈煡鏍囩 'description' 銆? [JavadocType
]
[ERROR] F:\Copote\Code\...\entity\AlertRuleEntity.java:7:4: 鏈煡鏍囩 'description' 銆? [Javad
ocType]
[ERROR] F:\Copote\Code\...\entity\AlertsEntity.java:7:4: 鏈煡鏍囩 'description' 銆? [JavadocT
ype]
[ERROR] F:\Copote\Code\...\entity\BaseEntity.java:12:47: WhitespaceAround: '{' is not preceded wi
th whitespace. [WhitespaceAround]
[ERROR] F:\Copote\Code\...\entity\HostConfigEntity.java:11:49: WhitespaceAround: '{' is not prece
ded with whitespace. [WhitespaceAround]
[ERROR] F:\Copote\Code\...\entity\HostEntity.java:7:4: 鏈煡鏍囩 'Author' 銆? [JavadocType]
[ERROR] F:\Copote\Code\...\entity\HostEntity.java:8:4: 鏈煡鏍囩 'Date' 銆? [JavadocType]
[ERROR] F:\Copote\Code\...\entity\HostEntity.java:9:4: 鏈煡鏍囩 'Version' 銆? [JavadocType]
[ERROR] F:\Copote\Code\...\entity\HostEntity.java:10:4: 鏈煡鏍囩 'Description' 銆? [JavadocTy
pe]
[ERROR] F:\Copote\Code\...\entity\HostTagEntity.java:6: 缂哄皯 Javadoc 銆? [JavadocType]
[ERROR] F:\Copote\Code\...\entity\MetricEntity.java:8:4: 鏈煡鏍囩 'description' 銆? [JavadocT
ype]
[ERROR] F:\Copote\Code\...\entity\MetricTemplateEntity.java:7:4: 鏈煡鏍囩 'description' 銆? [
JavadocType]
妫?鏌ュ畬鎴愩??
[INFO] ------------------------------------------------------------------------
...
Caused by: org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorException: There are 12 errors reported by Checkstyle 8.18 with ../../code-style/checkstyle.xml ruleset.at org.apache.maven.plugins.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle (DefaultCheckstyleExecutor.java:309)

定位到日志:

There are 8 errors reported by Checkstyle 8.18 with ../../code-style/checkstyle.xml ruleset. -> [Help 1]

原因是存在多处代码不符合风格。逐个检查修改即可。

这篇关于Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/300453

相关文章

IDEA Maven提示:未解析的依赖项的问题及解决

《IDEAMaven提示:未解析的依赖项的问题及解决》:本文主要介绍IDEAMaven提示:未解析的依赖项的问题及解决,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝... 目录IDEA Maven提示:未解析的依编程赖项例如总结IDEA Maven提示:未解析的依赖项例如

如何使用Maven创建web目录结构

《如何使用Maven创建web目录结构》:本文主要介绍如何使用Maven创建web目录结构的问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录创建web工程第一步第二步第三步第四步第五步第六步第七步总结创建web工程第一步js通过Maven骨架创pytho

Maven中的profiles使用及说明

《Maven中的profiles使用及说明》:本文主要介绍Maven中的profiles使用及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录主要用途定义 Profiles示例:多环境配置激活 Profiles示例:资源过滤示例:依赖管理总结Maven 中的

Maven 配置中的 <mirror>绕过 HTTP 阻断机制的方法

《Maven配置中的<mirror>绕过HTTP阻断机制的方法》:本文主要介绍Maven配置中的<mirror>绕过HTTP阻断机制的方法,本文给大家分享问题原因及解决方案,感兴趣的朋友一... 目录一、问题场景:升级 Maven 后构建失败二、解决方案:通过 <mirror> 配置覆盖默认行为1. 配置示

maven私服配置全过程

《maven私服配置全过程》:本文主要介绍maven私服配置全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录使用Nexus作为 公司maven私服maven 私服setttings配置maven项目 pom配置测试效果总结使用Nexus作为 公司maven私

SpringBoot整合Apache Flink的详细指南

《SpringBoot整合ApacheFlink的详细指南》这篇文章主要为大家详细介绍了SpringBoot整合ApacheFlink的详细过程,涵盖环境准备,依赖配置,代码实现及运行步骤,感兴趣的... 目录1. 背景与目标2. 环境准备2.1 开发工具2.2 技术版本3. 创建 Spring Boot

Linux中修改Apache HTTP Server(httpd)默认端口的完整指南

《Linux中修改ApacheHTTPServer(httpd)默认端口的完整指南》ApacheHTTPServer(简称httpd)是Linux系统中最常用的Web服务器之一,本文将详细介绍如何... 目录一、修改 httpd 默认端口的步骤1. 查找 httpd 配置文件路径2. 编辑配置文件3. 保存

Spring Boot 整合 Apache Flink 的详细过程

《SpringBoot整合ApacheFlink的详细过程》ApacheFlink是一个高性能的分布式流处理框架,而SpringBoot提供了快速构建企业级应用的能力,下面给大家介绍Spri... 目录Spring Boot 整合 Apache Flink 教程一、背景与目标二、环境准备三、创建项目 & 添

IDEA中Maven Dependencies出现红色波浪线的原因及解决方法

《IDEA中MavenDependencies出现红色波浪线的原因及解决方法》在使用IntelliJIDEA开发Java项目时,尤其是基于Maven的项目,您可能会遇到MavenDependenci... 目录一、问题概述二、解决步骤2.1 检查 Maven 配置2.2 更新 Maven 项目2.3 清理本

maven中的maven-antrun-plugin插件示例详解

《maven中的maven-antrun-plugin插件示例详解》maven-antrun-plugin是Maven生态中一个强大的工具,尤其适合需要复用Ant脚本或实现复杂构建逻辑的场景... 目录1. 核心功能2. 典型使用场景3. 配置示例4. 关键配置项5. 优缺点分析6. 最佳实践7. 常见问题