禁用maven checkstyle

Ran*_*der 62 checkstyle maven

我想执行一个maven目标,但checkstyle错误禁止这样做.我现在没时间纠正checkstyle错误(我的checkstyle规则最近已更新,我现在无法处理所有这些规则).

有没有办法禁用checkstyle操作并执行我的目标?

Ran*_*der 141

解决方案是:mvn [target] -Dcheckstyle.skip.

我喜欢这个解决方案,因为它是临时的,不需要编辑pom文件或任何可以版本化的东西.

  • mvn [target] -D"checkstyle.skip"= true(如果你使用的是Powershell) (5认同)
  • 即使这样,maven checkstyle仍然执行,我怎样才能禁用它,这样我就可以在不编辑pom的情况下加快编译速度 (3认同)

Con*_*dis 15

在一行中:

    <properties>
        <checkstyle.skip>true</checkstyle.skip>
    </properties>
Run Code Online (Sandbox Code Playgroud)


K. *_*Gol 8

如果要从pom禁用checkstyle,则可以将checkstyle插件添加到pom并将执行阶段设置为none。对我来说重要的是,我必须设置与父pom完全相同的id。在其他情况下,它不起作用。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <executions>
                <execution>
                    <id>checkstyle-validation</id>
                    <phase>none</phase>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)


Sve*_*ing 6

RandomCoders的答案是首选。

如果要从pom禁用checkstyle,则可以将checkstyle插件添加到pom并设置skip标志以阻止检查。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)