Monday, October 30, 2017

How to create a new project using apache maven 3.5.2

I just installed apache-maven-3.5.2 and oh boy creating a project seems very difficult. Specially if you are new. It seems it's not possible to create a new project according to the quick start tutorials.

xx> mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -Dgroup
Id=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.086 s
[INFO] Finished at: 2017-10-31T11:44:26+07:00
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (xxx). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException


Instead, try this

mvn -B archetype:generate -DinteractiveMode=true