1、构建archetype步骤
1、修改pom文件,添加archetype 插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>3.2.0</version>
</plugin>
2、cd 到项目根目录执行下面命令 生成archetype模板
mvn archetype:create-from-project
执行完该命令会在target目录下生成
进入archetype目录
cd target/generated-sources/archetype/
mvn install #安装到本地
执行下面命令生成archetype-catalog.xml文件 默认在settings.xml中配置的 E:\repository 目录中
mvn archetype:crawl
archetype-catalog.xml 文件内容如下
<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<archetypes>
<archetype>
<groupId>com.zds</groupId>
<artifactId>zds-archetype</artifactId>
<version>3.6.0</version>
<description>zds</description>
</archetype>
</archetypes>
</archetype-catalog>
idea 中使用自定义maven-archetype
编辑 groupId、artifactId、version 点击create 即可