https://www.tutorialspoint.com/maven/maven_creating_project.htm

1. create java project

mvn archetype:generate

choose default option (7: maven-archetype-quickstart)

choose groupId, artifactId, version, package

choose Y for confirmation

maven will create default project structure

2. build and test project

mvn clean package

gives maven 2 goals:

  • clean - clean the ./target directory
  • package - package the project build output as a .jar or .war into ./target directory
    • .jar or .war is placed into the ./target folder
    • test reports are in the surefire-reports

3. run the project

cd /target/classes
java [path to .class file]