Java IntelliJ IDEA 14:如何在将项目部署到 Tomcat 时跳过测试

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32006351/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 11:54:24  来源:igfitidea点击:

IntelliJ IDEA 14: How to skip tests while deploying project into Tomcat

javaspringspring-mvctomcatintellij-idea

提问by stevey

I have a Spring MVCproject using IntelliJ IDEA14 as my IDE (I'm new to IntelliJ IDEA; I used Eclipse).

我有一个Spring MVC项目,它使用IntelliJ IDEA14 作为我的 IDE(我是 IntelliJ IDEA 的新手;我使用了Eclipse)。

My main Java code is in folder src/main, and the unit test code is in src/test. While deploying the project, I found that all the unit tests are executed.

我的主要 Java 代码在文件夹中src/main,单元测试代码在src/test. 在部署项目时,我发现所有的单元测试都被执行了。

How can I skip all the unit tests while deploying the project into Tomcat?

将项目部署到 Tomcat 时如何跳过所有单元测试?

采纳答案by dimitrisli

In case you are using Maven, on the View> Tool Windows> Maven Projectsclick on the button shown below ( called Skip Tests Mode). Essentially it is taking the testphase out of the lifecycle when you say run package.

如果您使用的MavenView> Tool Windows>Maven Projects单击下面显示的按钮(称为Skip Tests Mode)。从本质上讲,test当您说 run 时,它是在生命周期之外的阶段package

enter image description here

在此处输入图片说明

回答by Hassam Abdelillah

When creating a maven configuration for the project. On the Runner tabyou can click on skip test checkbox as below :

为项目创建 maven 配置时。在Runner 选项卡上,您可以单击跳过测试复选框,如下所示:

enter image description here

在此处输入图片说明

It helped me a lot!

这对我帮助很大!