params

Java: Using Maven from the console for running classes, unit tests, checking dependencies

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’ Java: Using Maven from the console for running classes, unit tests, checking dependencies