声纳中的错误 cobertura“初始堆太小”

发布于 2025-01-06 05:58:33 字数 1260 浏览 1 评论 0原文

我正在使用声纳和 cobertura (用于代码覆盖率)。我对我面临的问题感到困惑。如果我运行,

mvn sonar:sonar

我在执行期间看到以下错误,

[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core ---
[INFO] Error occurred during initialization of VM
Too small initial heap

[ERROR] Error in Cobertura Report generation: Unable to generate Cobertura Report for project.
org.apache.maven.plugin.MojoExecutionException: Unable to generate Cobertura Report for project.
        at org.codehaus.mojo.cobertura.tasks.ReportTask.execute(ReportTask.java:93) 

如果我直接使用以下命令运行 cobertura 插件

mvn cobertura:cobertura

,则没有上述错误,并显示以下输出,我认为这是预期的输出。

[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 39 classes.
Report time: 1035ms

我已经设置了 MAVEN_OPTS (MAVEN_OPTS=-Xms512m) 环境变量,但仍然收到错误。

谁能告诉我出了什么问题以及如何解决这个问题?

I'm using sonar and cobertura (for code coverage). I'm baffled with the problem I'm facing. If I run

mvn sonar:sonar

I saw the following error during executions

[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core ---
[INFO] Error occurred during initialization of VM
Too small initial heap

[ERROR] Error in Cobertura Report generation: Unable to generate Cobertura Report for project.
org.apache.maven.plugin.MojoExecutionException: Unable to generate Cobertura Report for project.
        at org.codehaus.mojo.cobertura.tasks.ReportTask.execute(ReportTask.java:93) 

if I run the cobertura plugin directly using the following

mvn cobertura:cobertura

There is no error as above, and display the following output, which I assume was the expected output.

[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:cobertura (default-cli) @ hss-core ---
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 39 classes.
Report time: 1035ms

I have set the MAVEN_OPTS (MAVEN_OPTS=-Xms512m) environment variable, but still getting the error.

Can anyone tell me what went wrong, and how to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唐婉 2025-01-13 05:58:33

几乎感觉您在 -Xms 参数中省略了“m”:

$java -Xms512 -version
Error occurred during initialization of VM
Too small initial heap

检查其他环境变量的值以查看是否定义了任何与 Java 相关的内容(Windows 上的“set”命令应该将它们全部打印出来)不会有什么坏处 - 检查_JAVA_OPTS、MAVEN_OPTS 等。

It almost feel that you omitted 'm' in your -Xms parameter:

$java -Xms512 -version
Error occurred during initialization of VM
Too small initial heap

Won't hurt to check values for other environment variables to see if there is anything Java-related defined ('set' command on Windows should print them all) - check _JAVA_OPTS, MAVEN_OPTS etc.

韬韬不绝 2025-01-13 05:58:33

Sonar Cobertura 插件有一个特定参数来增加分配给 Cobertura 进程的内存:sonar.cobertura.maxmem

例如,您可以运行: mvn sonar:sonar -Dsonar.cobertura.maxmem=512m

请参阅 http://docs.codehaus.org/display/SONAR/Code+coverage+plugins#Cobertura

Sonar Cobertura Plugin had a specific parameter to increase the memory allocated to the Cobertura process: sonar.cobertura.maxmem

For instance, you can run: mvn sonar:sonar -Dsonar.cobertura.maxmem=512m

See http://docs.codehaus.org/display/SONAR/Code+coverage+plugins#Cobertura

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文