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

    ...
    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): : 

我怎样才能让 mvn 自己选择 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)
        ...

提前致谢

4

1 回答 1

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
于 2013-06-30T12:59:40.543 回答