用IDEA创建项目出错

用IDEA创建项目出错

之前的项目是可以正常建立的,但是在验证AreaController的时候报错了,想重新建立一个项目,就报错了

  • The metadata E:\maven-repo\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-alimaven.xml is invalid: unexpected markup 

D:\JDK8\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Users\Administrator\AppData\Local\Temp\archetypetmp -Dmaven.home=D:\apache-maven-3.6.3 -Dclassworlds.conf=D:\apache-maven-3.6.3\bin\m2.conf "-Dmaven.ext.class.path=D:\IDEA\IntelliJ IDEA 2020.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\IDEA\IntelliJ IDEA 2020.3\lib\idea_rt.jar=51171:D:\IDEA\IntelliJ IDEA 2020.3\bin" -Dfile.encoding=UTF-8 -classpath D:\apache-maven-3.6.3\boot\plexus-classworlds-2.6.0.jar;D:\apache-maven-3.6.3\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2020.3 -s D:\apache-maven-3.6.3\conf\settings.xml -DinteractiveMode=false -DgroupId=com.imooc -DartifactId=o2o -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=RELEASE org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate

[INFO] Scanning for projects...

[WARNING] The metadata E:\maven-repo\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-alimaven.xml is invalid: unexpected markup <!d (position: START_DOCUMENT seen \r\n<!d... @2:4) 

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  0.533 s

[INFO] Finished at: 2021-06-09T06:56:13+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (E:\maven-repo) -> [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:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException


Process finished with exit code 1


http://img1.sycdn.imooc.com//climg/60bff6b209fb121b11990371.jpg

http://img1.sycdn.imooc.com//climg/60bff6b2098dd09b11560707.jpg

http://img1.sycdn.imooc.com//climg/60bff6b209cae1f408420701.jpg

http://img1.sycdn.imooc.com//climg/60bff6b309611f3c05150457.jpg

http://img1.sycdn.imooc.com//climg/60bff6b309b6385008660214.jpg

http://img1.sycdn.imooc.com//climg/60bff6b3093e009508520715.jpg


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕小班 2021-06-09 15:09:50

同学你好,1、有用的报错信息是:

Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local

显示同学的plugins中,有一个文件找不到,可能是同学下载的时候没有下载好。

2、同学可以打开本地maven仓库,删除/org/apache/maven/plugins/下的maven-archetype-plugin文件夹,比如我的位置在这里:

http://img1.sycdn.imooc.com//climg/60c0683a09ab340303210142.jpg


可能因为是网络问题导致jar包下载有问题,同学可以多删除几次再新建试试。

3、在本地仓库配置为阿里云的国内maven仓库的镜像后,在idea中为maven添加参数:-DarchetypeCatalog=local

http://img1.sycdn.imooc.com//climg/60c068f2098f386c07470398.jpg

如上操作后再来试试。

祝学习愉快!

  • 提问者 视线模糊 #1

    在idea中为maven添加参数:-DarchetypeCatalog=local,这个参数的作用是什么?

    2021-06-10 20:56:36
  • 好帮手慕小脸 回复 提问者 视线模糊 #2

    同学你好,由于默认情况下,根据archetype创建maven项目会从网络下载catalog文件,导致创建maven项目缓慢,这里指定这个参数的作用就是为了解决这一问题,设置使用本地catalog文件,在IDEA中设置archetype的使用方式为local;

    祝学习愉快~

    2021-06-11 09:55:19
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师