- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经为此工作了几个小时,我尝试过的每一个我在网上找到的解决方案都没有任何区别。
我有一个用 Kotlin 编写的项目。我的 Sonar 服务器上安装了 Kotlin 插件。我正在使用 JaCoCo 插件为 Sonar 生成代码覆盖率报告。
我的项目是多模块的,但只有 1 个子模块有单元测试,所以我在那里定义了我的 JaCoCo 插件。
我也在使用 Surefire 插件。
这是我的 pom.xml 中的属性
<properties>
<sonar.java.binaries>target/classes</sonar.java.binaries>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>kotlin</sonar.language>
<sonar.sources>src/main</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.verbose>true</sonar.verbose>
<sonar.jacoco.reportsPath>target</sonar.jacoco.reportsPath>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>target/surefire-reports</sonar.surefire.reportsPath>
<surefireArgLine/>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<configuration>
<append>true</append>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>target/jacoco.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
mvn sonar:sonar -Dsonar.projectName=vqs -Dsonar.projectKey=vqs
tohrel@ussd-olm-016438:~/projects/project-name-redacted/vqs-api$ mvn sonar:sonar -Dsonar.projectName=vqs -Dsonar.projectKey=vqs
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Variant Query Service - API 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.4.0.905:sonar (default-cli) @ vqs-api ---
[INFO] User cache: /Users/tohrel/.sonar/cache
[INFO] SonarQube version: 7.2.1
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Publish mode
[INFO] Load global settings
[INFO] Load global settings (done) | time=143ms
[INFO] Server id: AWT2VY5OzSeF07PuEM-H
[INFO] User cache: /Users/tohrel/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=82ms
[INFO] Load/download plugins (done) | time=132ms
[INFO] Loaded core extensions:
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=140ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=63ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=618ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=19ms
[INFO] Project key: vqs
[INFO] Project base dir: /Users/tohrel/projects/project-name-redacted/vqs-api
[INFO] ------------- Scan vqs
[INFO] Load server rules
[INFO] Load server rules (done) | time=178ms
[INFO] Base dir: /Users/tohrel/projects/project-name-redacted/vqs-api
[INFO] Working dir: /Users/tohrel/projects/project-name-redacted/vqs-api/target/sonar
[INFO] Source paths: src/main
[INFO] Test paths: src/test
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Language is forced to kotlin
[INFO] Index files
[INFO] 254 files indexed
[INFO] Quality profile for kotlin: Sonar way
[INFO] Sensor Kotlin Sensor [kotlin]
[INFO] 208 source files to be analyzed
[INFO] Sensor Kotlin Sensor [kotlin] (done) | time=2693ms
[INFO] 208/208 source files have been analyzed
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=4ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=90ms
[INFO] Sensor CPD Block Indexer
[INFO] Sensor CPD Block Indexer (done) | time=0ms
[INFO] 57 files had no CPD blocks
[INFO] Calculating CPD for 151 files
[INFO] CPD calculation finished
[INFO] Analysis report generated in 484ms, dir size=658 KB
[INFO] Analysis reports compressed in 582ms, zip size=444 KB
[INFO] Analysis report generated in /Users/tohrel/projects/project-name-redacted/vqs-api/target/sonar/scanner-report
[INFO] Analysis report uploaded in 27ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=vqs
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://localhost:9000/api/ce/task?id=AWVagYWzPCQMqzjb5q73
[INFO] Task total time: 7.582 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.536 s
[INFO] Finished at: 2018-08-20T20:22:42-07:00
[INFO] Final Memory: 56M/869M
[INFO] ------------------------------------------------------------------------
最佳答案
在上面评论中@Godin 的帮助下(非常感谢),我的代码覆盖率正在工作。
这可能不是唯一的解决方案,但它对我有用。
首先,我从我的 extensions/plugins 目录中删除了官方的 sonar-kotlin-plugin,并添加了这个:https://github.com/arturbosch/sonar-kotlin
其次,我更新了似乎已过时的属性,使其类似于此示例中概述的内容:https://github.com/akquinet/kotlin-calculator/blob/master/pom.xml
属性(摘录)
<properties>
<!-- Sonar configuration -->
<jacoco.report.ut>${project.build.directory}/jacoco-ut.exec</jacoco.report.ut>
<jacoco.report.it>${project.build.directory}/jacoco-it.exec</jacoco.report.it>
<sonar.language>kotlin</sonar.language>
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.junit.reportPaths>${project.build.directory}/surefire-reports</sonar.junit.reportPaths>
<sonar.jacoco.reportPaths>${jacoco.report.ut},${jacoco.report.it}</sonar.jacoco.reportPaths>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefireArgLine}</argLine>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>${failsafeArgLine}</argLine>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<executions>
<execution>
<id>jacoco-agent-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${jacoco.report.ut}</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>jacoco-agent-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destFile>${jacoco.report.it}</destFile>
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
</executions>
</plugin>
关于maven - JaCoCo 报道缺失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51941225/
我在我的一个模块中通过 JaCoCo 生成 AHP 报告时遇到问题。当构建开始时,我看到 JaCoCo 正确设置 argLine 为: [INFO] jacoco.agent.argLine set
我正在尝试将 JaCoCo 添加到我的 Android 以覆盖 Sonar Qube。但是在运行命令 ./gradlew jacocoTestReport 时,我收到以下错误。 Task :app:
我用过 lombok.@UtilityClass到: 生成私有(private)构造函数 使类(class)最终 将实用程序类中的所有字段设为静态 并且 Jacoco 不涵盖 Lombok 生成的代码
我正尝试在我的 project 上创建一个 jacoco 报告.该项目是 java 12 版本,jacoco-maven-plugin 是 0.8.5 版本。
我的项目是使用 Maven 构建的。我使用“Jacoco”插件来执行质量检查。 对于一个项目,我想在线检查测试覆盖率。我只想检查仅 3 个包裹的线路覆盖率。如何指定此检查? 我尝试“包括”一些软件包,
我有一个 Maven 项目(Java)的 jacoco-agent 生成文件,名为 jacoco.exec . 如何将此文件转换为人类可读的格式? (HTML/XML)。 最佳答案 我相信这是在 of
我正在使用 Bamboo、SonarQube 和 Maven 插件在 SonarQube 中生成 Jacoco 报告。它正在生成 jacoco.exec 文件,但如何在 SonarQube 中显示报告
我正在运行 Jacoco 的 Maven 插件。 prepare-agent 目标运行良好,但由于某种原因没有生成 jacoco.exec 文件。随后,报告目标提示由于缺少执行数据文件而跳过 JaCo
我在我的项目中设置了 Jacoco 来执行 a) 检查代码覆盖率和 b) 生成覆盖率报告。生成的 HTML 报告显示了正确的覆盖率值,但 Jacoco 检查在构建过程结束时生成的警告消息显示了不同的错
我用的是官方example Socket server为我的 jacocoagent.jar 启动一个套接字服务器来连接。我这样启动我的目标 jar : java -javaagent:jacocoa
当 Jacoco 代码覆盖率低于一定百分比时,我试图使 Gradle 构建失败。 ...
我有一个 maven 项目,使用“测试”阶段和“集成测试”阶段。在测试阶段,执行 JUnit 测试,在集成测试中有 HTMLUnit 测试。我正在使用 Jacoco[1]-maven-plugin 来
我遇到以下错误: Plugin execution not covered by lifecycle configuration: org.jacoco:jacoco-maven-plugin:0.7
我在 Tomcat 上部署了一个 Web 应用程序。在我进入更多细节之前,让我详细说明这些版本。 版本:jdk 1.7,Tomcat - 7.0.19,jacoco -0.5.6 我已将jdk1.7
我按照以下步骤使用 jacoco 测量代码覆盖率: 我已经使用 jacoco 代理动态检测了我的应用程序 wars 文件。 启动 tomcat 服务器。 运行一些测试用例。 已停止 tomcat 服务
我将我的 Ant 任务配置为
我正在尝试让 jacoco+gradle 一起工作。看看这个论坛,似乎有些人已经成功地做到了。但是当我尝试时,我遇到了一个奇怪的异常。 我做了什么: 1.下载gradle 2.2.1并配置环境变量等。
我正在开发 SAML One Login Toolkit,并从 GitHub 获取了最新的主分支 here并使用 Eclipse Oxygen。它应该手动解决所有 Maven 依赖项,但不幸的是事实并
SonarQube 7.7 针对 Java 项目分析显示以下警告: Property 'sonar.jacoco.reportPath' is deprecated (JaCoCo binary fo
我有一个在 jboss 7.1.3 上部署并使用 arquillian 进行测试的项目,我正在尝试向其中添加代码覆盖率指标。 我正在使用托管容器选项(jboss-as-arquillian-conta
我是一名优秀的程序员,十分优秀!