How to run all tests in a particular package with Maven?

Viewed 113645

I can find in the Maven docs where it shows how to run:

  1. A single test
  2. All tests in a single test class
  3. All tests in classes matching a particular pattern

But how to run all the tests in a package? Is this possible?

I would prefer solutions that don't require modifying the pom.xml or code.

9 Answers

Had the same problem (how to run all tests in a particular package) and tried many ways, two commands that worked were:

mvn -Dtest=com.package.my.package.** test

mvn -Dtest=com.package.my.package.**.* test
Related