由于缺少执行数据错误而跳过JaCoCo执行

 mobiledu2502873797 发布于 2022-12-27 12:19

我正进入(状态

由于缺少执行数据文件而跳过JaCoCo执行:/scratch/jenkins/workspace/sonar-test/target/jacoco.exec错误

我的pom档案是:

    
        test-coverage
        
            
                
                    org.apache.maven.plugins
                    maven-surefire-plugin
                    ${maven.surefire.plugin.version}
                    
                        true
                        true
                           com.project.test.annotation.QuickTest
                    
                
                
                    org.jacoco
                    jacoco-maven-plugin
                    0.7.1.201405082137
                    
                        
                            
                                prepare-agent
                            
                        
                        
                            report
                            prepare-package
                            
                                report
                            
                        
                    
                

            
        
    

我错过了什么?

2 个回答
  • 您需要在surefire插件配置中添加$ {argLine}.例:

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.7.1.201405082137</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.14.1</version>
                        <configuration>
                            <argLine>${argLine}</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
    

    如果你想要你可以添加其他参数到surefire插件,如下所示:

    <argLine>${argLine} -XX:PermSize=128m -XX:MaxPermSize=512m</argLine>
    

    2022-12-27 12:21 回答
  • 丢失的另一个原因jacoco.exec可能是项目中没有任何单元测试.

    编辑:我想知道,为什么我的答案被否决,因为没有人在评论中留下任何理由.我们在包含3个子项目的项目中有相同的错误消息.其中一个是新的,没有任何测试 - 添加一个虚拟单元测试错误消失了.

    2022-12-27 12:24 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有