Running Maven
Once you have set up the Maven file structure, written your pom.xml
file, coded your sources, and added any resources, such as images, then all you need to do is use Maven, which is quite straightforward.
Let us begin by running Maven on the command line.
Command-line Maven
Here are the steps to follow to use Maven on the command line:
- Open a terminal or console in the folder that holds the project’s folders, such as
src
. - Configure your setup if needed, should you not be an admin or superuser.
- Enter the
mvn
command at the prompt. If there are no errors in your code, it should conduct all the goals you asked for. If there are errors, then you need to review the output of Maven, correct the errors, and usemvn
again.
Here is my output from a successful build:
C:\PacktJavaCode\CompoundInterest04>mvn [INFO] Scanning for projects... [INFO] [INFO] -------------------< com.kenfogel:compoundinterest >-------------------- [INFO...