6

Creating a project with archetype:generate in the same way as described in Maven in 5 Minutes.
Got this error:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/mnt/c/Users/etomort/quartz-poc). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/mnt/c/Users/etomort/quartz-poc). Please verify you invoked Maven from the correct directory.

Since it is such a basic thing, I just got confused...

I checked these two questions:

But neither the accepted answers solved the issue.
So, I am creating this question in case someone hits it and do not get it at first.

By the way, the Maven command entered is:

mvn archetype:generate -DgroupId=com.mycompany -DartifactId=quartz-poc -DarchetypeArtifactId= maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false  
nephewtom
  • 2,941
  • 3
  • 35
  • 49

3 Answers3

12

If you are on Windows and using the cmd command line or PowerShell, you need to wrap the arguments in quotes:

mvn archetype:generate "-DgroupId=com.mycompany" "-DartifactId=quartz-poc" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false"

On some machines, It works without the quotes on the cmd though.

Nasser Boukehil
  • 401
  • 2
  • 8
  • 18
3

Watch out for spaces in mvn command!

Any spaces before and after = makes mvn fail:
enter image description here

In my question, the extra space is in archetypeArtifactId.
Though wherever it is, Maven will complain with the same message.

I inadvertently introduced spaces with bash auto-completion capability:

enter image description here

nephewtom
  • 2,941
  • 3
  • 35
  • 49
1

If you are on Windows and using the cmd command line:

mvn archetype:generate -DgroupId=com.mycompany -DartifactId=quartz-poc -DarchetypeArtifactId= maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

If you are on Windows and using the PowerShell command line:

mvn archetype:generate "-DgroupId=com.mycompany" "-DartifactId=quartz-poc" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false"

小小鸟
  • 11
  • 1