gpt4 book ai didi

java - 在 IntelliJ Idea 中使用 Maven 依赖项运行 Arquillian 测试

转载 作者:行者123 更新时间:2023-12-01 12:40:44 26 4
gpt4 key购买 nike

当使用 Intellij 使用 pom 依赖项部署 Arquillian 测试时,例如:

    File[] libs = Maven.resolver().offline()
.loadPomFromFile("pom.xml")
.importRuntimeDependencies()
.resolve().withTransitivity().asFile();

测试在其他 IDE 中运行得很好,但使用 IntelliJ 时,会出现错误,无法正确执行测试。

最佳答案

Go to Edit Configurations (under Run menu), select Defaults branch and then JUnit. You can see that Working directory is set to project’s directory. That’s why pom.xml could not be found in this location. Fortunately it can be changed either to MAVEN_REPOSITORY or to MODULE_DIR and the latter is exactly what you want. Changing that and saving it in defaults makes the issue above disappear.

Now you can run your tests from IntelliJ even if you have maven dependencies to be included in your @Deployment archive.

如下所示:http://michalostruszka.pl/blog/2012/10/24/arquillian-tests-with-maven-deps-intellij/

关于java - 在 IntelliJ Idea 中使用 Maven 依赖项运行 Arquillian 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25122414/

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