Maven JaCoCo plugin error

后端 未结 5 1278
温柔的废话
温柔的废话 2020-12-05 05:01

I have configured the Maven JaCoCo plugin as follows in my pom.xml file:


    UTF-8         


        
5条回答
  •  旧巷少年郎
    2020-12-05 05:40

    I had the same trouble with jacoco and maven. It was related to a parent pom overwriting the configuration of surefire. In this case, that plugin didn't used the argument (for jvm argument) defining the agent.

    The solution was to put the "argLine" configuration element back

    
      maven-surefire-plugin
      
       ${argLine}
      
     
    

    Full plugin conf looks like

    
      maven-surefire-plugin
      
        true
      
      
        
          unit-test
          test
          
            test
          
          
            ${maven.test.skip}
            ${argLine}
            
              **/*IntegrationTest.java
            
          
        
        
          integration-test
          integration-test
          
            test
          
          
            ${skipITs}
            ${argLine}
            
              **/*IntegrationTest.java
            
          
        
      
    
    
        org.jacoco
        jacoco-maven-plugin
        0.5.10.201208310627
        
            ${maven.test.skip}
            ${basedir}/target/coverage-reports/jacoco-unit.exec
            ${basedir}/target/coverage-reports/jacoco-unit.exec
            file
            true
        
        
            
                jacoco-initialize
                
                    prepare-agent
                
            
            
                jacoco-site
                verify
                
                    report
                
            
        
    
    

    Hope it'll be usefull

提交回复
热议问题