myeclipse无法创建maven web项目:Could not resolve archetype

来源:互联网 发布:b超数据看男孩女孩 编辑:程序博客网 时间:2024/04/19 09:08

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.

    今天打开用的好好的ide,想新建一个maven web项目,结果出现Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.


网上有相关的解决方法:

在Eclipse Maven配置中添加新的Catalog配置:

  • http://repo1.maven.org/maven2/archetype-catalog.xml
 (在eclipse中window-->preference-->maven->archetypes页面下点击“Add Remote Catalog”,在弹出框中“Catalog File”中输入上面紫色字体 的链接 ,Description处可以根据自己的喜好填写;再次新建maven项目,在catalog的下拉选择框中选择刚才新建的Description处的名称即可)

       
以前遇到过这样的情况,并且根据以上的解决方法可以解决问题,可是这次怎么也不行,然后同事告诉说他也有遇到相似的问题,解决方法为更换本地仓库,照此方法试验了一遍,果然解决了问题。

       可是原来的仓库空间出现 了什么问题呢?
       于是马上比较了两个仓库的异同:原仓库org\apache\maven\archetypes\maven-archetype-webapp\1.0目录下多了一个名为的maven-archetype-webapp-1.0.jar.lastUpdate的文件,此种.lastUpdate文件是上次在拉jar包时没有成功拉下造成的,将此文件删除后原仓库将能正常使用。当你再次新建maven项目时,IDE会自动帮你下载你所需要的jar包,而如果没删除lastUpdate文件将不会继续下载相关的jar包。

       当然上面只是我的ide报出的错误,类似的错误还可能是因为其它的jar包引起,如果遇到相似的情况,仔细查看报错中“Could not resolve”之后的xx.xxx.xxx...在本地仓库中查找这个路径下的相关文件,删除相应的.lastUpdate文件就能解决此类的问题了。

0 0
原创粉丝点击