如何运行mvn archetype:使用-DinteractiveMode = false生成?

时间:2013-06-30 12:52:21

标签: maven

手动方式:

$ mvn archetype:generate -DgroupId=test -DartifactId=test \
-Dpackage=test -Dname="parent top level" \
-Dversion="1.0" -Dfilter=org.codehaus.mojo.archetypes:pom-root \
-DarchetypeArtifactId=1 -DinteractiveMode=false

    ...
    quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
    Choose archetype:
    1: remote -> org.codehaus.mojo.archetypes:pom-root (Root project archetype for creating multi module projects)
    Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 

如何让maven自己选择1)? 以下根本不起作用:

$ mvn archetype:generate -DgroupId=test -DartifactId=test \
-Dpackage=test -Dname="parent top level" -Dversion="1.0" -Dfilter=org.codehaus.mojo.archetypes:pom-root \
-DarchetypeArtifactId=1 -DinteractiveMode=false

        ...
        [ERROR] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] The desired archetype does not exist (org.apache.maven.archetypes:1:1.0)
        ...

提前致谢

1 个答案:

答案 0 :(得分:3)

使用-DarchetypeGroupId-DarchetypeArtifactId

mvn archetype:generate -DgroupId=test -DartifactId=test -Dpackage=test \
 -Dname="parent top level" -Dversion="1.0" \
 -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=pom-root \
 -DinteractiveMode=false