maven提供的脚手架archetype大家都知道啊,不知道的我这里也不多说了,请自行参考Maven插件之maven-archetype-plugin。本文接下来是简单介绍一下如何使用stdArcheType快速搭建快嘉开发框架1.1,参见快嘉开发框架1.1和示例介绍及使用说明

1、下载stdArcheType源码,选择分支release1.1,并install到本地仓库;
2、新建本地目录E:\tmp,cmd到该目录下,

E:\tmp>mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=com.fastjrun.share -DarchetypeArtifactId=stdArcheType -DarchetypeVersion=1.1 -DarchetypeCatalog=internal
[INFO] Scanning for projects...
Downloading: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/code
haus/mojo/maven-metadata.xml
Downloading: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/mule
/tools/maven-metadata.xml
Downloading: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/apac
he/maven/plugins/maven-metadata.xml
Downloaded: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/mule/
tools/maven-metadata.xml (2 KB at 1.9 KB/sec)
Downloaded: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/codeh
aus/mojo/maven-metadata.xml (20 KB at 34.6 KB/sec)
Downloaded: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/apach
e/maven/plugins/maven-metadata.xml (13 KB at 21.7 KB/sec)
Downloading: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/apac
he/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Downloaded: http://javafun.cuiyingfeng.com/nexus/content/groups/public/org/apach
e/maven/plugins/maven-archetype-plugin/maven-metadata.xml (759 B at 12.2 KB/sec)

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources
@ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources
@ 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 repository
 (http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository
is elsewhere.
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Archetype: stdArcheT
ype:1.1
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: com.fastjrun
[INFO] Parameter: artifactId, Value: demo
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: .
[INFO] Parameter: packageInPathFormat, Value: /
[INFO] Parameter: appName, Value: demo
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: .
[INFO] Parameter: groupId, Value: com.fastjrun
[INFO] Parameter: packagePrefix, Value: com.fastjrun.demo
[INFO] Parameter: artifactId, Value: demo
[INFO] Parent element not overwritten in E:\tmp\demo\Common\pom.xml
[WARNING] Don't override file E:\tmp\demo\Common\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Util\pom.xml
[WARNING] Don't override file E:\tmp\demo\Util\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Base\pom.xml
[WARNING] Don't override file E:\tmp\demo\Base\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Persistence-Impl\pom.xml
[WARNING] Don't override file E:\tmp\demo\Persistence-Impl\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Bundle\pom.xml
[WARNING] Don't override file E:\tmp\demo\Bundle\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Service-Impl\pom.xml
[WARNING] Don't override file E:\tmp\demo\Service-Impl\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Batch\pom.xml
[WARNING] Don't override file E:\tmp\demo\Batch\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Rest\Config\pom.xml
[WARNING] Don't override file E:\tmp\demo\Rest\Config\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Rest\Main\pom.xml
[WARNING] Don't override file E:\tmp\demo\Rest\Main\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\RestTest\pom.xml
[WARNING] Don't override file E:\tmp\demo\RestTest\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Web\Config\pom.xml
[WARNING] Don't override file E:\tmp\demo\Web\Config\pom.xml
[INFO] Parent element not overwritten in E:\tmp\demo\Web\Main\pom.xml
[WARNING] Don't override file E:\tmp\demo\Web\Main\pom.xml
[INFO] project created from Archetype in dir: E:\tmp\demo
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.533 s
[INFO] Finished at: 2016-08-22T22:45:54+08:00
[INFO] Final Memory: 12M/78M
[INFO] ------------------------------------------------------------------------
E:\tmp>tree /F
文件夹 PATH 列表
卷序列号为 22AF-E645
E:.
└─demo
    │  pom.xml
    │
    ├─Base
    │  │  pom.xml
    │  │
    │  └─src
    │      └─main
    │          └─java
    ├─Batch
    │  │  pom.xml
    │  │
    │  ├─config
    │  │      activemq.properties
    │  │      batch.properties
    │  │      jdbc.properties
    │  │      log4j.dtd
    │  │      log4j.xml
    │  │      rabbitmq.properties
    │  │      redis.properties
    │  │      service.properties
    │  │
    │  └─src
    │      └─main
    │          ├─bin
    │          │      shutdown.sh
    │          │      startup.bat
    │          │      startup.sh
    │          │
    │          ├─config
    │          │      activemq.properties
    │          │      batch.properties
    │          │      jdbc.properties
    │          │      log4j.dtd
    │          │      log4j.xml
    │          │      rabbitmq.properties
    │          │      redis.properties
    │          │      service.properties
    │          │
    │          ├─java
    │          └─resources
    │                  applicationContext-activemq-consumer.xml
    │                  applicationContext-batch-invalidLoginCredentialTask.xml
    │                  applicationContext-batch-unLockUserPwdTask.xml
    │                  applicationContext-batch.xml
    │                  applicationContext-rabbitmq-consumer.xml
    │                  applicationContext.xml
    │                  log4j.properties
    │                  package.xml
    │
    ├─Bundle
    │  │  pom.xml
    │  │
    │  └─src
    │      ├─main
    │      │  └─java
    │      └─test
    │          ├─java
    │          └─resources
    ├─Common
    │  │  pom.xml
    │  │
    │  └─src
    │      └─main
    │          └─java
    ├─Persistence-Impl
    │  │  pom.xml
    │  │
    │  └─src
    │      ├─main
    │      │  ├─java
    │      │  └─resources
    │      │          applicationContext-persistence.xml
    │      │          jdbc.properties
    │      │          log4j.properties
    │      │
    │      └─test
    │          ├─java
    │          └─resources
    │                  applicationContext.xml
    │                  testng.xml
    │
    ├─Rest
    │  ├─Config
    │  │  │  pom.xml
    │  │  │
    │  │  └─src
    │  │      └─main
    │  │          └─resources
    │  │                  activemq.properties
    │  │                  jdbc.properties
    │  │                  log4j.dtd
    │  │                  log4j.xml
    │  │                  package.xml
    │  │                  rabbitmq.properties
    │  │                  redis.properties
    │  │                  service.properties
    │  │
    │  └─Main
    │      │  pom.xml
    │      │
    │      └─src
    │          └─main
    │              ├─java
    │              ├─resources
    │              │      applicationContext.xml
    │              │      codeMsg.properties
    │              │      log4j.properties
    │              │
    │              └─webapp
    │                  └─WEB-INF
    │                          spring-mvc.xml
    │                          web.xml
    │
    ├─RestTest
    │  │  pom.xml
    │  │
    │  └─src
    │      └─main
    │          ├─java
    │          ├─resources
    │          │      log4j.properties
    │          │      package.xml
    │          │      service.properties
    │          │      testng.xml
    │          │
    │          └─testdata
    │                  local.properties
    │
    ├─Service-Impl
    │  │  pom.xml
    │  │
    │  └─src
    │      ├─main
    │      │  ├─java
    │      │  └─resources
    │      │          activemq.properties
    │      │          applicationContext-activemq-producer.xml
    │      │          applicationContext-jedis.xml
    │      │          applicationContext-rabbitmq-producer.xml
    │      │          applicationContext-service.xml
    │      │          jdbc.properties
    │      │          log4j.properties
    │      │          rabbitmq.properties
    │      │          redis.properties
    │      │          service.properties
    │      │
    │      └─test
    │          ├─java
    │          └─resources
    │                  applicationContext.xml
    │                  testng.xml
    │
    ├─Util
    │  │  pom.xml
    │  │
    │  └─src
    │      └─main
    │          ├─java
    │          └─resources
    └─Web
        ├─Config
        │  │  pom.xml
        │  │
        │  └─src
        │      └─main
        │          └─resources
        │                  activemq.properties
        │                  jdbc.properties
        │                  log4j.dtd
        │                  log4j.xml
        │                  package.xml
        │                  rabbitmq.properties
        │                  redis.properties
        │                  service.properties
        │
        └─Main
            │  pom.xml
            │
            └─src
                └─main
                    ├─java
                    ├─resources
                    │      applicationContext.xml
                    │      codeMsg.properties
                    │      freemarker.properties
                    │      log4j.properties
                    │
                    └─webapp
                        └─WEB-INF
                            │  spring-mvc.xml
                            │  web.xml
                            │
                            └─ftl

备注
1、mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=com.fastjrun.share -DarchetypeArtifactId=stdArcheType -DarchetypeVersion=1.1 -DarchetypeCatalog=internal命令中加入-DarchetypeCatalog=internal是为了生成脚手架快一些,否则会需要从远程服务器上下载很多archetype,导致生成慢;
2、该插件有几个参数,注意如下

<requiredProperties>
	<requiredProperty key="appName">
		<defaultValue>demo</defaultValue>
	</requiredProperty>
	<requiredProperty key="groupId">
		<defaultValue>com.fastjrun</defaultValue>
	</requiredProperty>
	<requiredProperty key="artifactId">
		<defaultValue>demo</defaultValue>
	</requiredProperty>
	<requiredProperty key="package">
		<defaultValue>.</defaultValue>
	</requiredProperty>
	<requiredProperty key="packagePrefix">
		<defaultValue>com.fastjrun.demo</defaultValue>
	</requiredProperty>
</requiredProperties>