Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways for Maven to skip testing

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what are the methods for Maven to skip the test". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the methods for Maven to skip the test"?

First, skip the test on the command line

We can skip the test with two commands

Mvn clean install-DskipTests

Mvn clean install-Dmaven.test.skip=true

-DskipTests, does not execute the test case, but compiles the test case class to generate the corresponding class file under target/test-classes

-Dmaven.test.skip=true, does not execute test cases and does not compile test case classes

With maven.test.skip, you can skip not only the running of unit tests, but also the compilation of test code

Use mvn package-DskipTests to skip the unit test, but continue to compile.

2. Configuration Skip Test in pom.xml

You can skip testing by adding the following configuration to pom.xml:

Org.apache.maven.plugins

Maven-surefire-plugin

True

3. Configuration skips testing in Idea

Idea is our common development tool, and we often package it directly with Idea plug-ins. We can skip the test through configuration.

1. Direct configuration

The toolbar of the Maven command bar has the icon in the following illustration, which is Skip Tests. Click select, and then use the package in LifeStyle to skip the test.

2. Change the Maven configuration

Method 1: open the configuration, find Maven-- > Runner, and add it to VM option.

-Dmaven.test.skip=true

Mode 2 is selected in Propertis Runnerlle->

Skip tests

At this point, I believe you have a deeper understanding of "what are the methods of Maven skipping testing?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report