向idea添加archetype之前的准备工作:
1.制作了一个通用的模板项目
2.在根目录执行mvn archetype:create-from-project
3.进入到target/generated-sources/archetype目录执行mvn install
4.导入本地仓库生成的archetype-catalog.xml, 在eclipse具体操作步骤:eclipse菜单->首选项->maven->archetype->add local catalog->选择本地仓库生成的archetype-catelog.xml,而我因工作环境需要在idea环境导入archetype,同样的点击新建项目->maven->勾选从原型构建->添加原型,输入完成后就无反应了
5.新建maven项目,select an archetype步骤选择前述步骤生成的archetype, 快速生成新的项目.
我是从eclipse转idea, eclipse上述步骤亲测通过ok, idea不能生成,想请问一下是什么原因。附使用mvn generate命令具体错误信息如下:
~ % mvn archetype:generate -DarchetypeGroupId=com.ruyi -DarchetypeArtifactId=ruyi-demo-api-archetype -DarchetypeVersion=1.0 -DgroupId=com.ruyi -DarchetypeArtifactId=ruyi-demo-api -Dversion=1.0 -DinteractiveMode=false -DarchetypeCatalog=local
...
[INFO] Generating project in Batch mode
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
[WARNING] The POM for com.ruyi:ruyi-demo-api:jar:1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.700 s
[INFO] Finished at: 2021-11-01T15:36:28+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.ruyi:ruyi-demo-api:1.0) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
...