0

我是 Maven 新手,尝试创建 now 项目时出现问题。

E:\java\MavenTest>mvn archetype:generate -DgroupId=com.mycompany.app -DartifacId
=my_app -DarchetypeArtifacId = maven_archetype_quickstart -DinteractiveMode=fals
e
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.108s
[INFO] Finished at: Wed May 15 23:55:57 CST 2013
[INFO] Final Memory: 7M/76M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
 in this directory (E:\java\MavenTest). 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 swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception

pom.xml 应该是自动生成的。但它不起作用。

任何帮助将不胜感激。

4

1 回答 1

1

根本原因如下:-

  1. 有一个空格在-DarchetypeArtifacId = maven_archetype_quickstart
  2. archetypeArtifacId应该是maven-archetype-quickstart
  3. -DarchetypeArtifacId是拼写错误,正确的是-DarchetypeArtifactId

那么请尝试以下方法:-

mvn archetype:generate 
    -DgroupId=com.mycompany.app 
    -DartifactId=my_app 
    -DarchetypeGroupId=org.apache.maven.archetypes 
    -DarchetypeArtifacId=maven-archetype-quickstart 
    -DarchetypeVersion=1.1 
    -DinteractiveMode=false

请在单行中键入上述命令。

我希望这可能会有所帮助。

于 2013-05-16T02:19:51.980 回答