简体   繁体   English

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

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

I have a Spring MVC project using IntelliJ IDEA 14 as my IDE (I'm new to IntelliJ IDEA; I used Eclipse ).我有一个使用IntelliJ IDEA 14 作为我的 IDE 的Spring MVC项目(我是 IntelliJ IDEA 的新手;我使用了 Eclipse )。

My main Java code is in folder src/main , and the unit test code is in src/test .我的主要 Java 代码在文件夹src/main中,单元测试代码在src/test中。 While deploying the project, I found that all the unit tests are executed.在部署项目时,我发现所有的单元测试都被执行了。

How can I skip all the unit tests while deploying the project into Tomcat?如何在将项目部署到 Tomcat 时跳过所有单元测试?

In case you are using Maven , on the View > Tool Windows > Maven Projects click on the button shown below ( called Skip Tests Mode ).如果您使用的是Maven ,请在View > Tool Windows > Maven Projects单击下面显示的按钮(称为Skip Tests Mode )。 Essentially it is taking the test phase out of the lifecycle when you say run package .本质上,当您说 run package时,它将test阶段从生命周期中package

在此处输入图片说明

When creating a maven configuration for the project.为项目创建 maven 配置时。 On the Runner tab you can click on skip test checkbox as below :Runner 选项卡上,您可以单击跳过测试复选框,如下所示:

在此处输入图片说明

It helped me a lot!这对我帮助很大!

Even I faced this same issue as I have newly started using IntelliJ starting today.即使我从今天开始新开始使用 IntelliJ,也遇到了同样的问题。 So I have trouble to find that logo in the screenshot shared in the post shared by dimitrisli and also accepted answer.所以我很难在dimitrisli共享的帖子中共享的屏幕截图中找到该徽标,并且也接受了答案。 Let me share my solution to this issue with latest IntelliJ version.让我用最新的 IntelliJ 版本分享我对这个问题的解决方案。

Open IntelliJ IDE, press Ctrl + Alt + S , this will open settings window, now look at the screenshot I shared and do the same settings and you are done.打开 IntelliJ IDE,按Ctrl + Alt + S ,这将打开设置 window,现在看看我分享的截图,做同样的设置,你就完成了。 Make sure you click the check box for Skip Tests .确保单击Skip Tests的复选框。

My IntelliJ IDE version:我的 IntelliJ IDE 版本:
IntelliJ IDEA 2022.2.4 (Community Edition)

在此处输入图像描述

在 Tomcat 运行/调试配置中,您可以在启动前部分使用此参数指定 maven 任务:

-Dmaven.test.skip=true

mvn -DskipTests=true clean install (or other command) mvn -DskipTests=true 全新安装(或其他命令)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM