Maven archetype 的创建和使用
原创
©著作权归作者所有:来自51CTO博客作者Andy_黎青的原创作品,请联系作者获取转载授权,否则将追究法律责任
Maven archetype 的创建和使用
生成 Archetype 文件
- 在目标项目的根目录
$project_dir
运行:mvn archetype:create-from-project
生成 archetype
-
archetype
文件生成目录:$project_dir\target\generated-sources\archetype
- 在
$project_dir\target\generated-sources\archetype
运行 mvn install
安装 archetype
- 默认安装地址为:
C:\Users\用户名\.m2\repository\xxx\yyy-archetype\1.0-SNAPSHOT\yyy-archetype-1.0-SNAPSHOT.jar
-
xxx
和 groupId
对应 -
yyy
和 artifactId
对应
通过 Archetype 创建项目
- 根据上一步生成的 archetype 填写:

- 通过刚刚添加的 Archetype 创建项目。创建的过程和平常使用
maven-archetype-quickstart
创建项目没有任何区别。