Update: The Surefire plugin version 2.3 has reportedly been upgraded
to support JUnit4. Please try adding the following to your pom.xml
before continuing on with the information found on this page.
You can also read the full announcement maven-users mailing list.
Thanks to Chris Moesel for passing along the good news!
This Maven 2
plugin was developed to temporarily address a shortcoming in the
standard Surefire plugin that prevents
it from executing JUnit
4 test classes. This plugin is in no way intended to replace
Surefire or even remain available after Surefire is upgraded. As such,
no further work is expected to be done on this plugin.
maven-junit4-plugin is executed during the
phase of the
All JUnit 4
test classes that were built into the
target/test-classes directory (the default test-compile
output directory) will automatically be executed when the
phase is run.
The paths for the project's classes and the test classes are
hard-coded to the maven default values of
The surefire plugin's test phase is not disabled. There is
therefore spurious Surefire output during the test phase.
No attempt is made to run JUnit 3 tests.
The unit tests run in the same JVM as maven itself. There is no
The unit tests for the plugin itself (i.e., if you were modifying
the source code for
maven-junit4-plugin) can not be run
natively inside Eclipse itself. You either need to test the plugin via
maven or set up Eclipse to execute
maven-junit4-plugin should require no modifications
to a project other than to the
pom.xml file itself.
Add the following to the project's
The maven-junit4-plugin should download and install automatically when
test is run.
To run the plugin, execute:
The pathological and curious alike can access the source code for the
maven-junit4-plugin via the Unto.net svn repository.
To check out a current copy of the
source code, please run:
svn co http://svn.unto.net/svn/public/maven-junit4-plugin/trunk/ \