gpt4 book ai didi

maven - 在 Maven 中禁用特定插件的并行构建

转载 作者:行者123 更新时间:2023-12-04 18:02:31 24 4
gpt4 key购买 nike

我使用 ma​​ven-T 选项构建我的项目。有时构建会因随机 checkstyle 错误而失败。

是否可以为特定插件(checkstyle)禁用-T选项并阻止并行执行该插件?

以防万一附加堆栈跟踪:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check (validate) on project yyy-1: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check (validate) on project yyy-1: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
...
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
...
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 11 more
Caused by: java.lang.NullPointerException
at com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.visitToken(AbstractJavadocCheck.java:182)
...
at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:265)
at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:252)
at org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:538)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 12 more

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check (validate) on project xxx-2: You have 1 Checkstyle violation. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check (validate) on project xxx-2: You have 1 Checkstyle violation.
...
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
...
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoFailureException: You have 1 Checkstyle violation.
at org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:588)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 11 more

最佳答案

直到 6.11 版本的 Checkstyle 甚至没有简单的线程安全。 Javadoc 检查使用在单个 JVM 中所有 Checkstyle 执行共享的静态缓存。

从 6.11 版开始,我用线程本地缓存替换了静态缓存,它同样快,但提供了基本的线程安全性。它使得在 Maven 和 Checkstyle 中使用 -T 选项成为可能。

关于maven - 在 Maven 中禁用特定插件的并行构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32769955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com