Occasionally I will have a problem with a JUnit test running in Eclipse but not in Maven. Any relatively large project will have hundreds of unit tests and simply doing 'mvn test' runs all of the unit tests in the project. When you want to run a single test use the "-Dtest" parameter:
mvn -Dtest=MyTest testIn the above command "MyTest" is the name of the test class you want to run.
Skipping your unit tests is generally a bad idea but sometimes necessary. If you are running a mvn target that internally calls the test target but you want to skip the tests you can add the "-Dmaven.test.skip" parameter to your command.
mvn -Dmaven.test.skip installFor more information about Maven go here
source: Maven FAQ