Eclipse Java EE 新 Maven 项目:无法解析原型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18499931/
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-08-12 08:37:03  来源:igfitidea点击:

Eclipse Java EE New Maven Project: Could not resolve archetype

javaeclipsemavenjakarta-eeproxy

提问by Man Friday

I am using the latest Eclipse Java EE(Kepler) and trying to create a Maven project. When I attempt to do this, and finally click the Finish button, I get this error:

我正在使用最新的Eclipse Java EE(Kepler) 并尝试创建一个 Maven 项目。当我尝试执行此操作并最终单击“完成”按钮时,出现此错误:

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

无法从任何配置的存储库解析原型 org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE。

All I have done in terms of "set-up" is install Eclipse Java EE (I also installed the main eclipse standard 4.3 earlier). I am also on a work computer, and a proxy test I ran returned the result: This request appears to have come via a proxy.

我在“设置”方面所做的就是安装 Eclipse Java EE(我之前还安装了主 Eclipse 标准 4.3)。我也在一台工作计算机上,我运行的代理测试返回了结果:此请求似乎是通过代理来的

This has driven me nearly insane, so any help would be great! Thanks!

这让我几乎疯了,所以任何帮助都会很棒!谢谢!

回答by user3012109

Please verify, in Eclipse, Windows > Preferences > Maven > User Settings, please check the User settings file (settings.xml) exists and the proxy setting inside that file is correctly pointed to your proxy server.

请验证,在 Eclipse 中,Windows > 首选项 > Maven > 用户设置,请检查用户设置文件 (settings.xml) 是否存在,并且该文件中的代理设置是否正确指向您的代理服务器。

回答by Dhrumil Shah

You can also add

您还可以添加

<mirror>
  <id>ibiblio.org</id>
  <url>http://mirrors.ibiblio.org/maven2</url>
  <mirrorOf>central</mirrorOf>
</mirror>

回答by Ayman Al-Absi

Best solution as below:

最佳解决方案如下:

  1. Close Eclipse
  2. Delete repository folder (you can find it in C:\Users{your user}.m2)
  3. Open Eclipse again. It will install maven repository automatically
  1. 关闭日食
  2. 删除存储库文件夹(您可以在 C:\Users{your user}.m2 中找到它)
  3. 再次打开 Eclipse。它将自动安装 maven 存储库

回答by Mahender Yadav

  1. Open Window > Preferences
  2. Open Maven > Archetypes
  3. Click 'Add Remote Catalog' and add the following:

  1. 打开窗口 > 首选项
  2. 打开 Maven > 原型
  3. 单击“添加远程目录”并添加以下内容:

回答by Charles Wang

Remove C:\Users\ {your username}\ .m2\repository\org\apache\maven folder and try to create your maven project again.

删除 C:\Users\ {your username}\ .m2\repository\org\apache\maven 文件夹并再次尝试创建您的 maven 项目。

回答by Eugene

Besides what have mentioned, it's required for me to modify proxy protocol from httpsto http.

除了上面提到的,我需要将代理协议从https修改为http

回答by user3673219

I had same problem and struggled lot to fix it out. I tried many thing including all the above answer.

我有同样的问题,并努力解决它。我尝试了很多事情,包括上述所有答案。

I solution worked for me is, I created the first Hello World project through command prompt (while creating first time it downloaded lot of things) and then I tried in eclipse. It worked for me !!!.

我的解决方案是,我通过命令提示符创建了第一个 Hello World 项目(第一次创建它下载了很多东西),然后我在 eclipse 中尝试。它对我有用!!!。

To create from Command Prompt, please follow the video from the below link.

要从命令提示符创建,请按照以下链接中的视频进行操作。

https://javabrains.io/courses/buildsys_mavenintro/lessons/Introduction-and-Setting-up-Part-1

https://javabrains.io/courses/buildsys_mavenintro/lessons/Introduction-and-Setting-up-Part-1

回答by Shubham Verma

Adding the following inside "mirrors" section in the user setting.xml file.

在用户 setting.xml 文件的“镜像”部分中添加以下内容。

<!-- mirrors so we can control the access of artifacts and avoid going to 
    the internet for artifact metadata -->
<mirrors>
    <mirror>
        <id>maven repo</id>
        <url>http://repo.maven.apache.org/maven2</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>

The official Maven 2 repository is at http://repo.maven.apache.org/maven2hosted in the US, or http://uk.maven.org/maven2hosted in the UK.

官方 Maven 2 存储库位于美国托管的http://repo.maven.apache.org/maven2或英国托管的http://uk.maven.org/maven2