Fork me on GitHub
What is the difference between maven-failsafe-plugin and maven-surefire-plugin?

maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately.

maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.


How can I reuse my test code in other modules?

Visit this link for your reference, | Attaching tests


Surefire fails with the message "The forked VM terminated without properly saying goodbye"

Surefire does not support tests or any referenced libraries calling System.exit() at any time. If they do so, they are incompatible with surefire and you should probably file an issue with the library/vendor. Alternatively the forked VM could also crash for a number of reasons, which can also make this issue happen. Look for the classical "hs_err*" files indicating VM crashes or examine the log output from running maven when the tests execute. Some "extraordinary" output from crashing processes may be dumped to the console/log. If this happens on a CI environment and only after some time runs there is a fair chance your test suite is leaking some kind of OS-level resource that makes things worse for every run. Regular os-level monitoring tools may give you some indication.


How can I run GWT tests ?
There is a specific gwt-maven-plugin at codehaus, but if you want to run with surefire, you need the following settings:

Use the following configuration:




try reuseForks=true and if it doesn't work, fall back to reuseForks=false


How do I use properties set by other plugins in argLine?

Maven does property replacement for

values in pom.xml before any plugin is run. So surefire would never see the place-holders in its argLine property.

Using an alternate syntax for these properties,

allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly.