eclipse 无法解析原型 org.apache.maven.archetypes:maven-archetype-webapp

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26632464/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:08:23  来源:igfitidea点击:

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp

xmleclipsemavenrepositorysetup-project

提问by DasBooten

I am getting the above error message when I try and create a simple maven project. I have exhausted the previous suggestions, e.g. Window > Preferences > Maven > Archetypes > Add Remote Catalog... and adding this as the catalog file: http://repo1.maven.org/maven2/archetype-catalog.xml

当我尝试创建一个简单的 maven 项目时,我收到了上述错误消息。我已经用尽了之前的建议,例如 Window > Preferences > Maven > Archetypes > Add Remote Catalog... 并将其添加为目录文件:http: //repo1.maven.org/maven2/archetype-catalog.xml

When I click verify it says this is empty.

当我点击验证时,它说这是空的。

I have also tried deleting the maven repository in the .m2 directory with no reward.

我也尝试删除 .m2 目录中的 maven 存储库而没有任何回报。

My complete error is this:

我的完整错误是这样的:

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\USER_ID\.m2\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\USER_ID\.m2\repository)

The maven-metadata.xml file is in the correct place (I think) but I'm not entirely sure if it is the right file contents, what should go in this file?

maven-metadata.xml 文件位于正确的位置(我认为)但我不完全确定它是否是正确的文件内容,该文件中应该包含什么内容?

I have also tried deleting and changing the settings.xml file in terms of both content and location, again with this repeated, infuriating message.

我还尝试删除和更改 settings.xml 文件的内容和位置,再次出现这种重复的、令人愤怒的消息。

回答by DasBooten

After some research on the same issue I have found that one of the solutions found was to follow these steps:

在对同一问题进行一些研究后,我发现找到的解决方案之一是遵循以下步骤:

Open Window > Preferences
Open Maven > Archetypes

打开窗口 > 首选项
打开 Maven > 原型

Click 'Add Remote Catalog' and add the following:

单击“添加远程目录”并添加以下内容:

Hope this is of some use to you.

希望这对你有用。