Excluding classes in Maven Checkstyle plugin reports

后端 未结 4 1816
故里飘歌
故里飘歌 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 08:15

    If, like me, you arrived here searching for a way to exclude generated sources from checkstyle, do this:

    
      org.apache.maven.plugins
      maven-checkstyle-plugin
      2.15
      
        ${project.build.sourceDirectory}
      
    
    

    By default, the checkstyle:checkstyle goal of the checkstyle plugin uses ${project.compileSourceRoots}, which apparently includes generated source directories.

    If you change it to ${project.build.sourceDirectory}, it will use only the source directory, not any generated source directories.

    Note that while is deprecated, the alternative, , does not appear to work.

提交回复
热议问题