简体   繁体   English

无法使用 Intellij IDE 收集 java maven 项目的覆盖率

[英]Fail to collect coverage for java maven projects with Intellij IDE

I wanted to collect coverage info, but the error message is "At least 5 arguments expected but 1 found."我想收集覆盖信息,但错误消息是“预计至少有 5 个参数,但找到了 1 个”。 I'm using IntelliJ IDE and maven projects and the Junit test framework.我正在使用 IntelliJ IDE 和 maven 项目以及 Junit 测试框架。 在此处输入图像描述 在此处输入图像描述

Also, I noticed that the path of the first argument includes illegal characters, which are not in English and are part of the user name of my computer.另外,我注意到第一个参数的路径包含非法字符,它们不是英文的,是我计算机用户名的一部分。

Alternatively, when I switched to Jacoco coverage tool instead of the tool provided by Intellij, the problem was "File Not Found Exception", the path of the file contained illegal characters.或者,当我切换到 Jacoco 覆盖工具而不是 Intellij 提供的工具时,问题是“File Not Found Exception”,文件路径包含非法字符。

I also tried uninstalling and reinstalling Intellij.我还尝试卸载并重新安装 Intellij。

I really do not know how to solve it;我真的不知道如何解决它; I would appreciate it if anyone could give me some help.如果有人能给我一些帮助,我将不胜感激。

在此处输入图像描述

Now I configured Jacoco in the POM file for my maven project and ran maven commands to collect code coverage.现在我在我的 maven 项目的 POM 文件中配置了 Jacoco,并运行 maven 命令来收集代码覆盖率。

The only solution that I found is to rename windows user.我找到的唯一解决方案是重命名 windows 用户。 It is a painful operation with modification of regisrty.修改注册表是一个痛苦的操作。

Here is the instruction in Russian.这是俄语的说明。

https://zen.yandex.ru/media/tehnichka/kak-pereimenovat-papku-polzovatelia-v-windows-10-5ffc31e6fe4e686f6ab950f5 https://zen.yandex.ru/media/tehnichka/kak-pereimenovat-papku-polzovatelia-v-windows-10-5ffc31e6fe4e686f6ab950f5

May be you will find the same in English.可能你会在英语中找到相同的。

As exception suggests your attempt to run with coverage has leak of sufficient argument to be executed, namely由于异常表明您尝试在覆盖范围内运行时泄漏了要执行的足够参数,即

  • Directory to save test coverage result保存测试覆盖结果的目录
  • Flag for identify the tracking per test用于标识每个测试的跟踪的标志
  • Flag to how calculate empty classes标记如何计算空
  • Flag for how to use data files如何使用数据文件的标志
  • Flag to indicate to run coverage in sampling (or tracing) mode指示在采样(或跟踪)模式下运行覆盖的标志

You can follow the official documentation for setting coverages in run configuration and passing required arguments regard to your case.您可以按照官方文档在运行配置中设置覆盖率并根据您的情况传递所需的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM