gpt4 book ai didi

maven-surefire-report-plugin 没有获取其配置

转载 作者:行者123 更新时间:2023-12-04 01:16:39 24 4
gpt4 key购买 nike

maven-surefire-report-plugin 有问题。我在我的 pom.xml 的报告部分添加了一些 reportSet 配置,但它似乎没有选择这个配置。

我是 lead to understand报告部分是寻找此类插件的方式,但我开始对此表示怀疑。

这是我的 pom.xml 的报告部分:

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.22.2</version>

<configuration>
<linkXRef>false</linkXRef>
</configuration>

<reportSets>
<reportSet>
<id>aggregated-unit-test-report</id>

<configuration>
<outputDirectory>${project.reporting.outputDirectory}/test-reports/ut</outputDirectory>
</configuration>

<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

这是(部分)我在该模块上运行 mvn surefire-report:report-only -X 得到的结果:

// Cropped for brevity
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-report-plugin:3.0.0-M5:report-only' with basic configurator -->
[DEBUG] (f) aggregate = false
[DEBUG] (f) alwaysGenerateSurefireReport = true
[DEBUG] (f) inputEncoding = ISO-8859-1
[DEBUG] (f) linkXRef = true
[DEBUG] (f) outputDirectory = C:\Users\francois.dupire\workspace\forhrm\libs\framework\coverage\target\site
[DEBUG] (f) outputName = surefire-report
[DEBUG] (f) project = MavenProject: be.formatech.forhrm.framework:framework-coverage:1.0.0-SNAPSHOT @ C:\Users\francois.dupire\workspace\forhrm\libs\framework\coverage\pom.xml
[DEBUG] (f) reactorProjects = [MavenProject: be.formatech.forhrm.framework:framework-coverage:1.0.0-SNAPSHOT @ C:\Users\francois.dupire\workspace\forhrm\libs\framework\coverage\pom.xml]
[DEBUG] (f) showSuccess = true
[DEBUG] (f) skipSurefireReport = false
[DEBUG] (f) xrefLocation = C:\Users\francois.dupire\workspace\forhrm\libs\framework\coverage\target\site\xref-test
[DEBUG] -- end configuration --
[WARNING] Unable to locate Test Source XRef to link to - DISABLED
// Cropped for brevity
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.976 s
[INFO] Finished at: 2020-08-04T17:24:57+02:00
[INFO] Final Memory: 13M/32M
[INFO] ------------------------------------------------------------------------

我们可以清楚地看到一切都是错误的,从头到尾:

  • 版本是3.0.0-M5,我指定的是2.22.2;
  • linkXRef 参数为 true 而不是 false;
  • 输出目录也没有改变。

我是否遗漏了有关此插件应该如何工作的信息?

最佳答案

  1. 版本是3.0.0-M5,我指定的是2.22.2

整个问题是您运行命令 mvn surefire-report:report-only 并且您希望激活 reporting 部分。您除了执行插件外什么都没做,因此 build/plugins/plugin 中的部分被激活,包括版本 2.22.2 而不是 reporting部分。如果你想激活 reporting 部分,你必须运行命令 mvn site 然后整个项目页面就会生成。

如果我处于你的位置并且只想生成 Surefire 报告,那么我会在 build/plugins/plugin/maven-surefire-report-plugin 中使用与你相同的配置现在在 reporting 部分完成。

    <configuration>
<linkXRef>false</linkXRef>
<outputName>test-reports/ut</outputName>
</configuration>
  1. linkXRef 参数为 true 而不是 false

与 1 相同的答案。

  1. 输出目录也没有改变

正确的 Maven 行为依赖于正确阅读文档,请参阅 link .请根据您的情况使用参数 outputName 而不是 outputDirectory(当 linkXRef 设置为 false 或覆盖默认值时Maven 属性 project.reporting.outputDirectory).

关于maven-surefire-report-plugin 没有获取其配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63250182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com