英文:
Stopping maven from running test while compiling intellij
问题
我的代码在编译时一直在运行测试,但单元测试失败了,我试图调试它,但无法找到错误的配置在哪里。我已经在整个互联网上搜索过了,但也许是我关键词不对。
TLDR:我的代码无法编译,因为当前的单元测试失败了,我无法调试单元测试,因为无法构建我的项目。
英文:
I am having a problem regarding my code keeps on running test while compiling the code but the unit test is wrong and I am trying to debug it but I can't. Where to look for the wrong configuration? I have search the whole internet for it but maybe my keyword is wrong.
TLDR: My code cannot compile because my current Unit Test is failed, I cannot debug the unit test because I can't build my project.
答案1
得分: 0
我认为你可以在`pom.xml`中的maven插件中添加一个跳过测试的配置。例如:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
然后当你重新运行项目时,单元测试将不会运行。
或者你可以在命令行中以另一种方式编译你的项目。
mvn package -Dmaven.test.skip=true
这个命令既不会编译单元测试代码,也不会运行单元测试。
英文:
I think you can add a skip tests configuration in your maven plugin in pom.xml
. for example :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
Then when you rerun the project, the unit tests will not run.
Or you just can compile your project in another way in the command line.
mvn package -Dmaven.test.skip=true
This command will nether compile the unit test code ,nor run the unit test.
答案2
得分: 0
尝试安装Maven扩展并关闭测试跳过测试
模式。
英文:
Try With Install Maven Extension and Turn off Test Toggle skip Tests
Mode.
答案3
得分: 0
在IntelliJ Idea中,转到设置 > 构建、执行、部署 > 构建工具 > Maven > 运行器,取消勾选“将IDE构建/运行操作委托给Maven”。就这样。
英文:
I have found the answer for anyone who stumbles upon the same problem.
In IntelliJ Idea > Settings > Build, Execution, Deployment > Build Tools > Maven > Runner > UN-TICK Delegate IDE build/run actions to Maven
That's it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论