[INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Batch mode以前都是网上随便找个文章搞一搞,或者有时候多等一会,解决了也就不管了,直到下次因为换电脑、重装idea等等,又不行了。我也奇怪,你拿Generating project in Batch mode去网上一搜,出来的解决办法还各不相同。
"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -Dmaven.home=F:\tools\apache-maven-3.8.1-bin\apache-maven-3.8.1 --errors -DgroupId=org.example -DartifactId=test8 -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DarchetypeRepository=F:/maven/repository org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate可以看下上面的命令,我已经去除了不重要的参数,剩下的分几个部分:
日志显示正在获取某个xml文件。
<!-- 堆代码 duidaima.com --> -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4文件内容大概如下,整个文件包含了5w多个模板,这么多,能不慢吗:
[DEBUG] Getting archetypes from catalog: F:\maven\repository\archetype-catalog.xml // 下面这行,意思是容错处理,去中央仓库拉取 [WARNING] Archetype not found in any catalog. Falling back to central repository.
-DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4拉取下来后,我们看看其内容:
[INFO] Generating project in Batch mode [DEBUG] Getting archetypes from catalog: F:\maven\repository\archetype-catalog.xml [INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.4] found in catalog local
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 -DgroupId=com.company -DartifactId=project -Dversion=1.0-SNAPSHOT -Dpackage=com.company.project -X --errors -DarchetypeCatalog=local这里-X,就和表示前面idea中的debug级别日志是一样的,具体可查看mvn -h:
-X,--debug Produce execution debug output另外,注意这里,指定了-Dpackage,即手动指定了我们module的包名。