1、下载simArcheType源码,并install到本地仓库;
2、新建本地目录E:\tmp,cmd到该目录下,
mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=com.fastjrun -DarchetypeArtifactId=simArcheType -DarchetypeVersion=1.0 -DarchetypeCatalog=internal -DgroupId=com.javafun -DartifactId=helloworld -Dversion=1.0.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] -----------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-source
@ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-source
@ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom
-
[INFO] Generating project in Batch mode
[WARNING] Archetype not found in any catalog. Falling back to central reposito
(http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repositor
is elsewhere.
[INFO] -----------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Archetype: simArch
ype:1.0
[INFO] -----------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: com.javafun
[INFO] Parameter: artifactId, Value: helloworld
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: package, Value: ./
[INFO] Parameter: packageInPathFormat, Value: //
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: package, Value: ./
[INFO] Parameter: groupId, Value: com.javafun
[INFO] Parameter: artifactId, Value: helloworld
[WARNING] Don't override file E:\tmp\helloworld\pom.xml
[INFO] project created from Archetype in dir: E:\tmp\helloworld
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 2.666 s
[INFO] Finished at: 2016-04-03T11:58:49+08:00
[INFO] Final Memory: 13M/310M
[INFO] -----------------------------------------------------------------------
E:\tmp>tree helloworld /F
E:\TMP\HELLOWORLD
│ pom.xml
│
└─src
├─main
│ ├─java
│ └─resources
│ applicationContext-persistence.xml
│ applicationContext.xml
│ jdbc.properties
│ log4j.properties
│
└─test
├─java
└─resources
备注
1、mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=com.fas tjrun.share -DarchetypeArtifactId=stdArcheType -DarchetypeVersion=1.0 -Darchetyp eCatalog=internal命令中加入-DarchetypeCatalog=internal是为了生成脚手架快一些,否则会需要从远程服务器上下载很多archetype,导致生成慢;
2、该插件有几个参数,注意如下
<requiredProperties>
<requiredProperty key="groupId">
<defaultValue>com.fastjrun</defaultValue>
</requiredProperty>
<requiredProperty key="artifactId">
<defaultValue>demo</defaultValue>
</requiredProperty>
<requiredProperty key="package">
<defaultValue>./</defaultValue>
</requiredProperty>
<requiredProperty key="version">
<defaultValue>1.0.0-SNAPSHOT</defaultValue>
</requiredProperty>
</requiredProperties>