Skip testing during Maven packaging and skip maven Packaging

Source: Internet
Author: User

Skip testing during Maven packaging and skip maven Packaging

In a specific project, if you need to skip the test stepSkipTestsThis attribute is set to true.

<pre name="code" class="html"><project>  [...]<!--http://blog.csdn.net/redstarofsleep-->    <build>    <plugins>      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-surefire-plugin</artifactId>        <version>2.18.1</version>        <configuration>          <skipTests>true</skipTests>        </configuration>      </plugin>    </plugins>  </build>  [...]</project>


 
You can also skip the test on the command line: 

mvn install -DskipTests

You can also use Maven. test. skipProperty skipping test compilation

mvn install -Dmaven.test.skip=true

If you want to skip the test by default, but you can manually enable it when executing the command, you need to configure it in pom as follows:

<!--http://blog.csdn.net/redstarofsleep--><project>  [...]  <properties>    <skipTests>true</skipTests>  </properties>  [...]  <build>    <plugins>      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-surefire-plugin</artifactId>        <version>2.18.1</version>        <configuration>          <skipTests>${skipTests}</skipTests>        </configuration>      </plugin>    </plugins>  </build>  [...]</project>
Enable it manually when executing the command line:

mvn install -DskipTests=false

For specific descriptions, refer to the official description of skip test: http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html


Reprinted please indicate the source:

Http://blog.csdn.net/redstarofsleep

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.