Maven check style as a part of the build

前端 未结 3 2007
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-02 11:10

Is there a possibility to somehow force maven to fail the build if there are some checkstyle errors? Now I have to run site goal to generate java

3条回答
  •  情歌与酒
    2021-02-02 11:22

    You need to bind checkstyle:check to a Maven lifecycle phase (e.g. validate ) and set failOnViolation to true.

    Something like:

    
        org.apache.maven.plugins
        maven-checkstyle-plugin
        2.9.1
        
            
            checkstyle
            validate
            
                check
            
            
                true
            
            
        
    
    

提交回复
热议问题