mvn archetype:generate 执行很慢的原因
首先 执行分析
mvn -X archetype:generate
发现 执行获取 remote 的 archetype-catalog.xml 文件 会很慢
可以通过指定参数 -DarchetypeCatalog 的值来决定从哪里家在文件
The archetype catalogs to use to build a list and let the user choose from. It is a comma separated list of catalogs. Catalogs use the following schemes:
- ‘file://…’ with archetype-catalog.xml automatically appended when pointing to a directory
- ‘http://…’ or ‘https://…’ with archetype-catalog.xml always appended
- ‘local’ which is the shortcut for ‘file://~/.m2/archetype-catalog.xml’
- ‘remote’ which is the shortcut for Maven Central repository, ie ‘http://repo.maven.apache.org/maven2’
- ‘internal’ which is an internal catalog
将文件下载之后 放在 file://~/.m2/archetype-catalog.xml 这里
指定参数 -DarchetypeCatalog=local