Forkmode Analysis of Maven-surefire-plugin

Source: Internet
Author: User

Today encountered a strange problem, the same test code, the local execution of no problem, but to the test machine execution, will prompt "No symbol found", the compile-time classpath is not found. Troubleshooting Half-day, found to be maven-surefire-plugin plug-in forkmode problem, I wrote in the Pom file is <forkMode>always</forkMode>. Take this out of the good, according to reason, not because of this cause the class path to find the problem Ah, search the use of the following Forkmode, as follows:

When Maven runs a test case, it executes the use case by calling MAVEN's surefire plug-in and fork a child process. The Forkmode property indicates whether you want to create a process for each test, or if all tests are completed in the same process.


Forkmode can be set to a value of "never", "once", "Always" and "pertest".
Pretest: Each test creates a new process, and creating a new JVM for each test is the most thorough method of individual testing, but is also the slowest, not suitable for continuous regression on Hudson.
Once: All tests are performed in one process. Once is the default setting and it is recommended to use the default setting for continuous regression on Hudson.
Always: Run scripts in parallel in a process, Junit4.7 or later, Surefire version to provide this feature at more than 2.6, where ThreadCount: Specifies the number of threads that can be allocated when executing. Valid only with the parameter parallel. Default: 5.


Attached to maven common plugins: http://maven.apache.org/plugins/index.html

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.