我尝试使用以下命令创建Maven项目:
mvn archetype:generate
不幸的是,它没有用,所以我在网上搜索。感谢stackoverflow,我明白错误与我公司的代理有关,所以我在下面创建了一个settings.xml文件:
$ {}的user.home /。平方米/ settings.xml中
这是settings.xml文件:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<id>my_id</id>
<active>true</active>
<protocol>http</protocol>
<host>my_host</host>
<port>my_port</port>
<nonProxyHosts>localhost|127.0.0.1|*.my_company.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
代理标签是由同事给出的,应该是正确的。 但是,我仍然有错误,这是错误消息:
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
***
Some warnings here
***
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.285 s
[INFO] Finished at: 2019-04-09T16:05:17+02:00
[INFO] ------------------------------------------------------------------------
[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\ho.hince\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[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
C:\Users\ho.hince\Desktop\Spring\test>mvn archetype: generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.132 s
[INFO] Finished at: 2019-04-09T16:09:58+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\ho.hince\Desktop\Spring\test). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[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/MissingProjectException
我想知道主机或端口号是否错误,所以我试图多次更改它以查看会发生什么。 当我将端口号更改为随机端口时,我仍然有相同的错误,但过程显着减慢。 我在这个网站和其他网站上搜索了几个小时的解决方案,但仍然找不到灵魂。 我真的很抱歉,如果我在这个问题上犯了一个错误,但我花了半个小时来制作它,并确保遵循指示。 先感谢您。 :) P.S:对不起,对于英语错误,它不是我的主要语言。
我找到了一个解决方案,我更改了settings.xml服务器标签。 我把它改成了Nexus网址,所以,我下载了我公司的罐子。 如果您的SSL证书存在同样的问题,我需要在JAVA中导入证书。
sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径
您可以在此视频中找到答案: https://www.youtube.com/watch?v=z3tAp3m5YBo