Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Test Settings

Property Optional? Description
maven.junit.dir Yes The directory to invoke the VM in. (ignored if fork is disabled). The default value is ${basedir}.
maven.junit.envvars Yes If fork is enabled, additional environment variables may be passed to the new VM. You can specify some variable separated by a space. Each variable is describe in sub properties. Sample :
maven.junit.envvars=LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/local/lib
maven.junit.jvm Yes If this property is set it is used as the JVM for the junit tests to run in. This is passed to the Ant junit task in the jvm property. If maven.junit.fork is not true, this is ignored.
maven.junit.jvmargs Yes If fork is enabled, additional parameters may be passed to the new VM. You can specify some args separated by a space. Sample :
maven.junit.jvmargs=-Xmx160m -verbose
maven.junit.fork Yes When using Java 1.4, it may be necessary to fork the JUnit tests to prevent XML parser issues. The default value is no.
maven.junit.forkmode Yes NOTE: Ignored in maven < 1.1. Controls how many Java Virtual Machines get created if you want to fork some tests. Possible values are "perTest" (the default), and "once". "once" creates only a single Java VM for all tests while "perTest" creates a new VM for each TestCase class. Note that only tests with the same settings of filtertrace, haltonerror, haltonfailure, errorproperty and failureproperty can share a VM, so even if you set forkmode to "once", Ant may have to create more than a single Java VM. This attribute is ignored for tests that don't get forked into a new Java VM. Defaults to perTest.
maven.junit.format Yes Specifies the formatter to use for output to the console. Can be xml, brief or plain. Defaults to brief.
maven.junit.printSummary Yes If this value is set to false, JUnit test run details will not include test summary information for a suite. Default value is true. This parameter corresponds to the JUnit Ant task printSummary attribute.
maven.junit.timeout Yes Cancel the individual tests if they don't finish in the given time (measured in milliseconds). Ignored if fork is disabled.
maven.junit.usefile Yes If this value is set to false, JUnit test run details will appear on the console as the tests are executed. If not, they are stored in a file in the test-reports directory. The default value is true.
maven.test.compile.compilerargs Yes Specifies compiler arguments to be used for tests compilation. Requires maven.test.compile.fork to bet set to true. Defaults to ${maven.compile.compilerargs}.
maven.test.compile.encoding Yes Specifies source encoding to be used for tests compilation. Defaults to ${maven.compile.encoding}.
maven.test.compile.executable Yes Names the program to be invoked as the java compiler for test classes. Defaults to ${maven.compile.executable}.
maven.test.compile.fork Yes Runs the test classes compiler in a separate process. Defaults to ${maven.compile.fork}.
maven.test.compile.source Yes Specifies the source version for the Java compiler for test classes. Defaults to ${maven.compile.source}.
maven.test.compile.target Yes Generate class files for test classes for a specific JVM version. Defaults to ${maven.compile.target}.
maven.test.compile.verbose Yes Asks the compiler for verbose output. Defaults to ${maven.compile.verbose}.
maven.test.classpath Yes Specifies one or more locations that will be added to the classpath when the tests are run. Multiple values can be used; the rules of the ant <pathelement path="..."> directive apply.
maven.test.compile.src.set Yes The source directories Maven uses to compile test code.
maven.test.dest Yes Specifies the unit test classes directory. This is the location where the java classes for the test source code will be generated to. The default value is ${maven.build.dir}/test-classes.
maven.test.error.ignore Yes Set this to true to ignore errors during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
maven.test.excludeXmlApis Yes If set to yes, the XML APIs will not be added to the list of libraries used for your test cases when forked. This should be used when you provide your own XML APIs library. By default, it is no.
maven.test.failure.ignore Yes Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
maven.test.haltafterfailure Yes Set this to true to halt the build on any test failures (note: errors are considered failures as well), but after all tests have been run. Default value is false.
maven.test.reportsDirectory Yes Directory to write the reports to. Defaults to ${maven.build.dir}/test-reports.
maven.test.skip Yes Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion. Ignored by test:single.
maven.test.source Yes

Provide source compatibility with a specific release

Corresponds to the source attribute for the ant javac task.

maven.junit.sysproperties Yes Use this property elements to specify system properties required by the class. These properties will be made available to the VM during the execution of the test (either Maven's VM or the forked VM, if fork is enabled). You can specify system properties separate by space. Each properties is describe in sub properties. Sample :
maven.junit.sysproperties=prop1 basedir
prop1=your value
basedir=${basedir}
maven.test.search.classdir Yes Use this property to specify that JUnit should search the test classes directory (${maven.test.dest}) rather than the source directory (${pom.build.unitTestSourceDirectory}). This allows for test cases to be written in other languages such as Groovy which generate bytecode that can then be used by this plugin. It might also be necessary to specify this property if you use <sourceModifications> in your pom. Sample :
maven.test.search.classdir=true
testmatchpattern Yes (required in test:match) List of ant patterns (spared by commas) used in test:match goal to specify the tests that should run
testnotmatchpattern Yes List of ant patterns (spared by commas) used in test:match goal to specify the tests that shouldn't run