Integration Test Coverage in SonarQube from JaCoCo Maven plug-in showing 0%

前端 未结 5 664
天命终不由人
天命终不由人 2021-02-05 14:58

We have a multi-module multi-language maven java project with coverage analysis with jacoco. The main part of the modules is backend (Java code) with a REST API and our webapp m

5条回答
  •  孤街浪徒
    2021-02-05 15:29

    Im using a similar setup and everything works perfectly with the following configuration:

    However the maven-surefire-plugin was causing troubles initially. Thats why I had to add the @{argLine} in the argLine tag, since the jacoco-maven-plugin:prepare-agent goal is executed before the maven-surefire-plugin. (see https://stackoverflow.com/a/25774988)

    Hope I could help

    
        
            org.sonarsource.scanner.maven
            sonar-maven-plugin
            3.4.0.905
        
        
            org.apache.maven.plugins
            maven-surefire-plugin
    
            
                
                    test
                
            
            
                
                @{argLine} -Xmx256m
            
        
    
        
            org.jacoco
            jacoco-maven-plugin
            0.7.9
            
                
                    jacoco-initialize
                    
                        prepare-agent
                    
                
                
                
                    jacoco-site
                    package
                    
                        report
                    
                
            
        
    
    

提交回复
热议问题