注意:1.模板项目名,系统会自动在项目后面新增archetype;
2.模板拉下来很慢时,可在下图处增加一项配置:archetypeCatalog internal
1.配置插件
<distributionManagement>
<repository>
<id>releases</id>
<url>仓库位置</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>仓库位置</url>
</snapshotRepository>
</distributionManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
2.到项目的根目录执行 mvn archetype:create-from-project
3.在target目录里的pom.xml中添加配置,在<name>xxx-archetype</name>下将仓库地址附上
4.target里面的archetype目录下,执行mvn install (可能因为文本编辑的原因,会报找不到命令,请手打)
5.同样目录下执行 mvn deploy
坑:更换maven的setting后不生效,导致推不到私库:mvn deploy -s /Users/cisdi/apache-maven-3.6.1/conf/cisdi/settings.xml,后面一定要指定setting文件
备注不关心: mvn clean install -U