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
创建项目没有任何区别。