Add a repository with id ‘archetype‘ in your settings.xml if archetype‘s repository(解决方法)
Add a repository with id ‘archetype’ in your settings.xml if archetype’s repository is elsewhere.
学习maven遇到的idea的问题,用maven来创建javaweb项目时,一直出现这个错误,大概意思就是没有找到catalog文件,返回到中心仓库去找。
其实就是少了archetype-catalog.xml文件,在本地仓库的中。
解决方法
1.在maven中找到在conf/setting.xml进行如下配置:
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
2.之后cmd输入mvn archetype:crawl
生成对应的xml,没环境变量的进安装目录
3.配置如下-DarchetypeCatalog=local
4.成功之后是这样的