我正在尝试创建一个新的 Maven 项目,但我做不到。我尝试了命令行,也尝试了 Eclipse。
我在尝试使用命令行时遇到的错误是
[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
在四处寻找错误的解决方案后,问题似乎出现了,因为我在工作中受防火墙/代理的保护。
然后我被建议进入 Eclipse 并尝试将远程目录 URL 添加到 Eclipse。我所做的是转到 Windows > Preferences > Maven > Archetypes > Add Remote Catalog。然后我将它放在 http://repo1.maven.org/maven2/archetype-catalog.xml
用于“Catalog File”字段和 maven catalog
用于“Description”字段。
然后我单击验证以查看它是否正常工作,我收到一条警告,指出“远程目录为空”。
无论如何,我继续尝试创建一个新的 Maven 项目。填写我的 groupId
等所有内容后,我单击“完成”。出现另一个错误
Could not resolve archetype
org.apache.maven.archetypes:maven-archetype-webapp:1.0 form any of the configured repositories.
我该如何解决这个问题?
最佳答案
我今天通过先在浏览器中下载文件然后将其添加为本地文件来修复它
关于java - 使用远程目录 URL 时无法从 Maven 获取任何原型(prototype),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37963852/