Disable maven checkstyle

后端 未结 4 1567
一向
一向 2021-01-30 19:41

I want to execute a maven target but checkstyle errors forbids that. I have no time right now to correct checkstyle error (my checkstyle rules have been recently updated and I c

相关标签:
4条回答
  • 2021-01-30 20:00

    Solution is : mvn [target] -Dcheckstyle.skip.

    I like this solution as it is temporary and do not require editing of pom files, or anything that can be versioned.

    0 讨论(0)
  • 2021-01-30 20:04

    RandomCoders answer is the preferred one.

    If you want to disable checkstyle from your pom, you can add the checkstyle plugin to the pom and set the skip flag to prevent the check.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
            <skip>true</skip>
        </configuration>
    </plugin>
    
    0 讨论(0)
  • 2021-01-30 20:06

    If you want to disable checkstyle from pom, you can add checkstyle plugin to your pom and set execution phase to none. Important thing for me was that I have to set id exactly the same as in parent pom. In othercase it doesn't works.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>checkstyle-validation</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
    
    0 讨论(0)
  • 2021-01-30 20:13

    In one line:

        <properties>
            <checkstyle.skip>true</checkstyle.skip>
        </properties>
    
    0 讨论(0)
提交回复
热议问题