以下apache
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-archetype-plugin</artifactId> <version>3.0.1</version> </plugin>
若是使用的是eclipse工具,右键->Debug As->Maven build,执行mvn archetype:create-from-projecteclipse
会生成target\generated-sources\archetype目录,进入该目录,执行maven
mvn install
build success,表示Archetype已经安装到本地仓库。工具
查看Maven安装目录下conf文件夹中的settings.xml文件,若是你在此设置了<localRepository>本地仓库路径,则Archetype就安装在这个路径下。同时在<localRepository>默认路径:我的文件夹/.m2目录下会有一个archetype-catalog.xml文件,若是没有这个文件,就执行 mvn archetype:crawl 命令生成该文件。打开文件,能够看到Archetype的groupId、artifactId等。ui
<?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>test.pro</groupId> <artifactId>test.pro-archetype</artifactId> <version>1.0.0</version> <description>test.pro-archetype</description> </archetype> </archetypes> </archetype-catalog>
eclipse新建maven project,进入到spa
默认是没有咱们自定义的Archetype,点击上面的按钮插件
添加本地catalogcode
选中生成的archetype-catalog.xml,点击ok,就能够获得xml
mvn archetype:generate
选择对应的数字,生成本地项目。ip
(1)archetype-catalog.xml删除:打开我的文件夹/.m2目录下的archetype-catalog.xml文件,将对应的<archetype></archetype>删除,好比删除文中刚刚安装的自定义archetype,那就把第5步中的<archetype></archetype>删除;
(2)eclipse删除:如图
某些时候,咱们可能对生成的archetype不太满意,好比要改动配置文件,虽然也能够新建项目后直接修改,但这样每次新建后都要修改,因此就在源项目中先修改了,而后再从新生成一次archetype吧。
(1).执行上面的删除步骤;
(2).进入项目根目录,把target\generated-sources\archetype目录下的文件都删除掉或者直接把target下的generated-sources文件夹删掉,而后从新生成Archetype就好了。