JaCoCo not generating jacoco.exec until after skipping JaCoCo execution

后端 未结 6 1029
执念已碎
执念已碎 2021-02-19 00:27

I\'m having trouble generating AHP reports via JaCoCo in one of my modules. When the build starts, I see JaCoCo correctly setting argLine with:

[INFO] jacoco.age         


        
6条回答
  •  再見小時候
    2021-02-19 00:56

    I did not find any solution, but I did the following:

    mvn clean jacoco:prepare-agent install create file jacoco.exec, but execute mvn sonar:sonar not create File.

    Solution:

    Step 1: mvn clean jacoco:prepare-agent install

    Step 2: copy file jacoco.exec from /src/main/resources Step 3:

    Add next plugin on pom.xml

    
                    org.apache.maven.plugins
                    maven-resources-plugin
                    2.7
                    
                        
                            copy-resources
                            validate
                            
                                copy-resources
                            
                            
                                
                                    ${basedir}/target/
                                
                                    
                                        
                                            ${basedir}/src/main/resources/ 
                                        
                                            jacoco.exec
                                        
                                    
                                
                            
                        
                    
                    
                        cp1252
                    
                
    

    Step 4: mvn clean install

    Step 5:

    mvn sonar:sonar

    READY

    Add my section Plugins

    
            
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    3.6.1
                    
                        1.7
                        1.7
                        cp1252
                    
                
                
                    org.apache.maven.plugins
                    maven-resources-plugin
                    2.7
                    
                        
                            copy-resources
                            validate
                            
                                copy-resources
                            
                            
                                
                                    ${basedir}/target/
                                
                                    
                                        
                                            ${basedir}/src/main/resources/ 
                                        
                                            jacoco.exec
                                        
                                    
                                
                            
                        
                        
                            copy-folder
                            package
                            
                                copy-resources
                            
                            
                                ${project.build.directory}
                                
                                    
                                        false
                                        ${project.basedir}/src/main/resources
                                    
                                
                            
                        
                    
                    
                        cp1252
                    
                
                
                
                    org.apache.maven.plugins
                    maven-release-plugin
                    2.5.1
                
                
                    org.jacoco
                    jacoco-maven-plugin
                    0.7.6.201602180812
    
                    
                        ${project.build.directory}/jacoco.exec
                    
    
                    
                        
                            jacoco-initialize
                            
                                prepare-agent
                            
                            
                                ${basedir}/target/jacoco.exec
                                ${basedir}/target/jacoco.exec
                            
                        
                        
                            jacoco-site
                            package
                            
                                report
                            
                        
                    
                
            
        
    

提交回复
热议问题