Tony
Tony

Reputation: 479

How to test multiple maven projects using single command?

I've got a set of maven projects and I feel really tired to test every project with mvn test. How can I organize my code to run all the tests using just one command? Can I do this using <modules>?

Upvotes: 0

Views: 38

Answers (1)

Stanislav Bashkyrtsev
Stanislav Bashkyrtsev

Reputation: 15308

Yes, that's exactly what <modules> is for. So if you run mvn clean test in the root dir of your super-project the clean and test phases are going to be executed against the 1st module and then against the 2nd and so on.

If there are dependencies between modules, then Maven will build a graph and will know the right order of modules to work with.

If you still need to execute a command against only one or two modules you can do that in the super-project dir with -pl module1-name,module2-name flag.

Upvotes: 1

Related Questions