Any easy way to generate a Findbug HTML report from Maven without site:site?

后端 未结 2 1076
终归单人心
终归单人心 2021-01-02 03:14

I am trying to integrate FindBugs in a maven project. Does anyone have a sample pom.xml generating a simple findbug HTML report in target? Is it possible to gen

2条回答
  •  失恋的感觉
    2021-01-02 03:49

    Findbugs jar contains 5 XSLT transformations that can be used to convert hard to read XML to easy to read HTML so we can use xml-maven-plugin plugin to execute transformation and here is the configuration:

    
        
            org.codehaus.mojo
            findbugs-maven-plugin
            2.4.0
            
                
                    findbug
                    verify
                    
                        check
                    
                
            
            
                
                    ${project.build.directory}/findbugs
                
                false
            
        
    
        
            org.codehaus.mojo
            xml-maven-plugin
            1.0
            
                
                    verify
                    
                        transform
                    
                
            
            
                
                    
                        ${project.build.directory}/findbugs
                        ${project.build.directory}/findbugs
                        fancy-hist.xsl
                        
                        
                        
                        
                        
                            
                                .html
                            
                        
                    
                
            
            
                
                    com.google.code.findbugs
                    findbugs
                    2.0.0
                
            
        
    
    

    To get the report just execute mvn clean install.

    The above code snippet contains all 5 possible transformations so try them all and hopefully you will find one you like.

    I tried it with maven 3 and Finbugs 2.0

提交回复
热议问题