How to exclude packages from CheckStyle analysis in a mavenized multi-module project?
05:19 25 Sep 2014

I have a Maven project with several modules, including org.eclipse.cdt.core. For some reason, the customer wants to build org.eclipse.cdt.core as well.

I want to generate an aggregated Checkstyle report, from which some files, including all org.eclipse.cdt.core.* (incl. subpackages) classes are excluded.

For this purpose, I specified the excludes tag as

**/org/eclipse/cdt/core/**/*,org.eclipse.cdt.core/src/**/*,../org.eclipse.cdt.core/src/**/*,org.eclipse.cdt.core/**/*

Then I ran mvn clean checkstyle-aggregate site, opened the file target/checkstyle-result.xml and found following lines in it:





This means that my tag doesn't work.

Then, I put the lines


    true

into pom.xml files of all modules to be excluded from Checkstyle, but it didn't help.

How can I generate a CheckStyle report (XML or HTML), without the results for certain modules (other than taking the 180 MB large target/checkstyle-result.xml and removing all "wrong" file enries from there) ?


    4.0.0
    mycompany-parentproject
    com.mycompany.parent
    1.0.0-SNAPSHOT
    pom

    
        0.21.0
        0.21.0
        UTF-8
        1.7
    

    
        
            Codehaus repository
            http://repository.codehaus.org/
        
    

    
        
            ${project.artifactId}-site
            ${project.baseUri}
        
    
    
        
            
                
                org.eclipse.tycho
                tycho-maven-plugin
                ${tycho-version}
                true
            
            
                org.eclipse.tycho
                target-platform-configuration
                ${tycho-version}
                
                    
                        
                            win32
                            win32
                            x86_64
                        
                        
                            win32
                            win32
                            x86
                        
                        
                            linux
                            gtk
                            x86_64
                        
                        
                            linux
                            gtk
                            x86
                        
                    
                
            
            
                org.eclipse.tycho
                tycho-versions-plugin
                ${tycho-version}
            
            
                org.eclipse.tycho
                tycho-packaging-plugin
                ${tycho-version}
                
                    'mycompany_'yyyyMMddHHmm
                
            
        
    
    
        ../com.mycompany.module1
        ../com.mycompany.module2
        ../com.mycompany.module3
        ../org.eclipse.cdt.core
    
    
        
            
                org.apache.maven.plugins
                maven-site-plugin
                3.0
                
                    
                        
                            org.apache.maven.plugins
                            maven-project-info-reports-plugin
                            2.7
                        

                        
                            org.apache.maven.plugins
                            maven-checkstyle-plugin
                            2.8
                            
                                sun-coding-standard.checkstyle.xml
                                **/org/eclipse/cdt/core/**/*,org.eclipse.cdt.core/src/**/*,../org.eclipse.cdt.core/src/**/*,org.eclipse.cdt.core/**/*
                                true
                            
                            
                                
                                    aggregate
                                    
                                        aggregate
                                    
                                
                            
                        

                        
                            org.codehaus.mojo
                            findbugs-maven-plugin
                            3.0.0
                            
                                true
                            
                            
                                
                                    aggregate
                                    
                                        aggregate
                                    
                                
                            
                        
                    
                
            
            
                org.codehaus.mojo
                findbugs-maven-plugin
                3.0.0
                
                    true
                
            
            
                org.apache.maven.plugins
                maven-pmd-plugin
                
                    true
                
            
        
    

Update 1 (25.09.2014 13:03 MSK): Tried to use suppression filters by adding


    sun-coding-standard.checkstyle.xml
    checkstyle-suppressions.xml

with checkstyle-suppressions.xml being equal to






    
    
    
    

It didn't help.

Adding checkstyle.suppressions.files to the above section was of no help, either.

java maven maven-3 checkstyle