eclipse 使用远程目录 URL 时无法从 Maven 获取任何原型

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

Cannot get any archetypes from Maven when using the remote catalog URL

javaeclipseapachemaven

提问by TheRealRave

I'm trying to create a new Maven project but I can't. I tried the command line and also through Eclipse.

我正在尝试创建一个新的 Maven 项目,但我不能。我尝试了命令行,也尝试了 Eclipse。

The error I get when trying to use the command line is along the lines of

我在尝试使用命令行时遇到的错误是

[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\MY_NAME.m2\repository), central (https://repo.maven.apache.org/maven2)]-> [Help 1]

[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/NoPluginFoundForPrefixException

[错误] 在当前项目和插件组 [org.apache.maven.plugins, org.codehaus.mojo] 中找不到前缀“原型”的插件,可从存储库 [本地 (C:\Users\MY_NAME.m2 \repository),中央(https://repo.maven.apache.org/maven2)]-> [帮助 1]

[错误] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。

[错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。

[错误]

[ERROR] 有关错误和可能的解决方案的更多信息,请阅读以下文章:

[错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

After searching around for the solution to the error, the problem seems to occur because I'm behind a firewall/proxy here at work.

在四处寻找错误的解决方案后,问题似乎发生了,因为我在工作中的防火墙/代理后面。

I was then advised to go into Eclipse and try adding the remote catalog URL to Eclipse. What I done was I went to Windows > Preferences > Maven > Archetypes > Add Remote Catalog. I then put it http://repo1.maven.org/maven2/archetype-catalog.xmlfor the "Catalog File" field and maven catalogfor the "Description" field.

然后我被建议进入 Eclipse 并尝试将远程目录 URL 添加到 Eclipse。我所做的是转到 Windows > Preferences > Maven > Archetypes > Add Remote Catalog。然后我把它放在http://repo1.maven.org/maven2/archetype-catalog.xml“目录文件”字段和maven catalog“描述”字段中。

I then click Verify to see if it was working and I got a warning saying that the "Remote catalog is empty".

然后我单击“验证”以查看它是否正常工作,并收到一条警告,指出“远程目录为空”。

I went ahead and tried to create a new Maven project anyway. After filling out my groupIdand all that, I click finish. Another error comes up saying

我继续尝试创建一个新的 Maven 项目。填写groupId完我的和所有这些后,我点击完成。出现另一个错误说

Could not resolve archetype

org.apache.maven.archetypes:maven-archetype-webapp:1.0 form any of the configured repositories.

无法解析原型

org.apache.maven.archetypes:maven-archetype-webapp:1.0 形成任何配置的存储库。

How do I get around this?

我该如何解决这个问题?

回答by zicheng gan

I fixed it today by firstly downloading the file in the browser then adding it as local file

我今天通过首先在浏览器中下载文件然后将其添加为本地文件来修复它

回答by jimmy

This works for me. I downloaded and saved the archtype-catalog xml file to local drive and then added using "Add Local Catalog".

这对我有用。我将 archtype-catalog xml 文件下载并保存到本地驱动器,然后使用“添加本地目录”添加。

回答by Cosburn

http://repo1.maven.org/maven2/archetype-catalog.xmlis the "given" link to get access the the remote archetype.

http://repo1.maven.org/maven2/archetype-catalog.xml是访问远程原型的“给定”链接。

However it may be outdated. You need to include http (s) therefore https://repo1.maven.org/maven2/archetype-catalog.xmlis what is required to get the remote archetypes to appear in eclipse or your favorite browser.

但是它可能已经过时了。您需要包含 http (s),因此https://repo1.maven.org/maven2/archetype-catalog.xml是让远程原型出现在 eclipse 或您喜欢的浏览器中所必需的。

回答by Milan Mandal

I fixed it today by firstly downloading the file in the browser then adding it as local file. You need to include http (s) Try the below link:- https://repo1.maven.org/maven2/archetype-catalog.xml

我今天通过首先在浏览器中下载文件然后将其添加为本地文件来修复它。您需要包含 http (s) 尝试以下链接:- https://repo1.maven.org/maven2/archetype-catalog.xml

回答by mohd mohsin

just look at the address you havnt put https https://repo1.maven.apache.org/maven2try this it will halpful to

看看你没有放的地址https://repo1.maven.apache.org/maven2试试这个它会半途而废