I’ve created a simple console Java application that is built with Maven. Is there a way that the main class (which doesn’t require any arguments) can be run from the command-line using a maven command like:
mvn run-app com.example.MainClass
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try the maven-exec-plugin. From there:
This will run your class in the JVM. You can use
-Dexec.args="arg0 arg1"to pass arguments.If you’re doing this regularly, you can add the parameters into the pom.xml as well: