In this short article, I’ll provide some Maven commands that I’ve found helpful.
Run single class from src/main/java
mvn exec:java -Dexec.mainClass=this.is.MyClass -Dexec.args="myarg1 'my second arg' myarg3"
Run unit test from src/test/java, all methods decorated with @Test
mvn test -Dtest=this.is.MyTestClass
Run unit test from src/test/java, only methods decorated with @Test and that start with ‘testDatabase’
mvn test -Dtest=this.is.MyTestClass#testDatabase*