Skip unit test in Maven

Source: Internet
Author: User

You may want to configure Maven to skip the unit test completely. Maybe you have a large system. Unit Testing takes many minutes to complete, but you don't want to wait until the final output is generated. You may be working on a legacy system that has a series of failed unit tests. You may just want to generate a jarInstead of fixing all unit tests. Maven provides the ability to skip unit tests. You only need to use the surefire plug-inskipParameters. In the command line, you just need to addmaven.test.skipProperty to skip the test:

$ MVN install-dmaven. Test. Skip = true
...
[Info] [Compiler: testcompile]
[Info] Not compiling test sources
[Info] [surefire: Test]
[Info] tests are skipped.
...

 

When surefire plug-in arrivestestIfmaven.test.skipSettrueThe unit test is skipped. Another way to configure Maven to skip unit test is for your projectpom.xmlAdd this configuration. You need yourbuildAddpluginElement.

 

<Project>
[...]
<Build>
<Plugins>
<Plugin>
<Groupid> Org. Apache. Maven. plugins </Groupid>
<Artifactid> Maven-surefire-plugin </Artifactid>
<Configuration>
<Skip> True </Skip>
</Configuration>
</Plugin>
</Plugins>
</Build>
[...]
</Project>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.