为什么mvn原型对我不起作用?

时间:2013-05-15 16:07:30

标签: maven-3

我是Maven的新手,当我尝试创建一个现在的项目时出现了问题。

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。但它不起作用。

任何帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分:1)

根本原因如下: -

  1. -DarchetypeArtifacId = maven_archetype_quickstart
  2. 有一个空格
  3. archetypeArtifacId应为maven-archetype-quickstart
  4. -DarchetypeArtifacId拼写错误,正确为-DarchetypeArtifactId
  5. 然后请尝试以下方法: -

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

    请在单行中输入以上命令。

    我希望这可能有所帮助。