由于没有班级文件,因此无法对项目范围进行JaCoCo分析 [英] No JaCoCo analysis of project coverage can be done since there is no class files

查看:57
本文介绍了由于没有班级文件,因此无法对项目范围进行JaCoCo分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Bamboo,SonarQube和Maven插件在SonarQube中生成Jacoco报告.它正在生成jacoco.exec文件,但是如何在SonarQube中显示报告?以下插件我正在使用 '

I am using Bamboo, SonarQube, and Maven plugin for generating the Jacoco Report in SonarQube. It is generating jacoco.exec file but how to display reports in SonarQube? Following plugin i am using '

<plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.7.201606060606</version>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <destFile>${project.build.directory}/jacoco.exec</destFile>
                            <!-- Sets the name of the property containing the settings for JaCoCo 
                                runtime agent. -->
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <!-- Ensures that the code coverage report for unit tests is created 
                        after unit tests have been run. -->
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/jacoco.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.15</version>
                <configuration>
                    <!-- Sets the VM argument line used when unit tests are run. -->
                    <argLine>${surefireArgLine}</argLine>
                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->
                    <skipTests>${skip.unit.tests}</skipTests>
                    <!-- Excludes integration tests when unit tests are run. -->
                    <excludes>
                        <exclude>**/IT*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>'

我正在遵循例外

build   08-Sep-2016 15:33:06    INFO: Sensor JaCoCoSensor
build   08-Sep-2016 15:33:06    INFO: No JaCoCo analysis of project coverage can be done since there is no class files.
build   08-Sep-2016 15:33:06    INFO: Sensor JaCoCoSensor (done) | time=72ms
build   08-Sep-2016 15:33:06    INFO: Sensor JaCoCoOverallSensor
build   08-Sep-2016 15:33:06    INFO: Analysing /opt/shared/atlassian/bamboo/xml-data/build-dir/EV-LEV362-JOB1/enterprise/projects/target/jacoco.exec
build   08-Sep-2016 15:33:06    INFO: No JaCoCo analysis of project coverage can be done since there is no class files.
build   08-Sep-2016 15:33:06    INFO: Sensor JaCoCoOverallSensor (done) | time=100ms
build   08-Sep-2016 15:33:06    INFO: Sensor XmlFileSensor

推荐答案

build 08-Sep-2016 15:33:06信息:由于没有类文件,因此无法对JaCoCo进行项目覆盖率分析.

build 08-Sep-2016 15:33:06 INFO: No JaCoCo analysis of project coverage can be done since there is no class files.

就像在日志中说的那样;检查是否指定了以下内容:

Like it said in the logs; check if you have specified following:

sonar.java.binaries=classes directory, most likely target/classes

如果您还可以指定更好的方法(那么它应该不会抱怨找不到某些类):

Works better if you can also specify (it then should not complain about some classes not being found):

sonar.java.libraries=libraries directory, likely target/project/WEB-INF/lib

这篇关于由于没有班级文件,因此无法对项目范围进行JaCoCo分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆