Excluding classes in Maven Checkstyle plugin reports

后端 未结 4 1824
故里飘歌
故里飘歌 2020-12-09 07:24

I have a Maven 2 project and I want to configure my Checkstyle report plugin so that only some of my classes are analysed. I have found the maven.checkstyle.excludes<

4条回答
  •  无人及你
    2020-12-09 07:52

    The answers above didn't work for me as I'm running code generation in maven which also adds the target/generated as a source dir.

    The following solution works: You have to use an explicit checkstyle-suppressions.xml config file and activate it from your configuration:

    
      
        org.apache.maven.plugins
        maven-checkstyle-plugin
        3.1.1
        
          checkstyle.xml
          checkstyle-suppressions.xml
       [...]
    

    The suppressions file for excluding the target folder looks like this:

    
    
    
    
      
    
    

提交回复
热议问题