gpt4 book ai didi

java - 无法使用 mojo 的构建帮助程序查看生成的测试源文件夹

转载 作者:行者123 更新时间:2023-12-01 12:13:38 25 4
gpt4 key购买 nike

我已将 mojo 的插件 build-helper 添加到我的项目 pom 中,为我的集成测试生成一个新的测试源文件夹。当我运行该阶段时,生成测试源

   mvn generate-test-sources

我可以看到下面的控制台输出显示已生成测试源文件夹,但是当我查看项目资源管理器时,我没有看到任何已创建的文件夹。

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for *******
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.guava:guava:jar -> version 18.0 vs ${guava.version} @ line 154, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.unitils:unitils-core:jar -> duplicate declaration of version 3.3 @ line 164, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building projectxxStaticAnalysisxxxxx versionxxxxx
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ StaticAnalysis ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ StaticAnalysis ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- build-helper-maven-plugin:1.9:add-test-source (add-integration-test-sources) @ StaticAnalysis ---
[INFO] Test Source directory: C:\{workspacepath}\src\integration-test\java added.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.421 s
[INFO] Finished at: 2014-11-25T11:26:59-06:00
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------

下面是我的pom插件配置

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

我做错了什么吗?请帮忙。

谢谢

最佳答案

我想我找到了问题的答案。我实际上期待构建帮助插件为我创建测试文件夹。但事实是,它不会为您创建该文件夹。

您必须创建测试文件夹并使用此构建帮助程序插件来告诉 maven 将您创建的文件夹视为测试文件夹,如上面我的 pom 中所示。我可以通过创建一个新的测试文件夹并运行以下命令来解决我的问题

mvn generate-test-sources eclipse:eclipse

希望这对某人有帮助!

关于java - 无法使用 mojo 的构建帮助程序查看生成的测试源文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27133328/

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