问题描述
- 我开始此教程,适用于win 8.1.
- 我下载了JDK8和Maven.
-
我设置了Maven(将mvn添加到PATH,设置JAVA_HOME).
- I started doing this tutorial, on win 8.1.
- I downloaded JDK8 and Maven.
I set up Maven (added mvn to PATH, set JAVA_HOME).
-
mvn --version
的输出:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00)Maven home: C:\apache\apache-maven-3.3.9\bin\..Java version: 1.8.0_122-ea, vendor: Oracle CorporationJava home: C:\Program Files\Java\jdk1.8.0_122\jreDefault locale: en_US, platform encoding: Cp1255OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00)Maven home: C:\apache\apache-maven-3.3.9\bin\..Java version: 1.8.0_122-ea, vendor: Oracle CorporationJava home: C:\Program Files\Java\jdk1.8.0_122\jreDefault locale: en_US, platform encoding: Cp1255OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
为项目创建的文件夹.
试图运行此命令(从教程中复制粘贴,忽略SO中的换行符):mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeGroupId=org.apache.maven.archetypes -DinteractiveMode=false -DgroupId=com.example.employees -DartifactId=employees-app -DarchetypeVersion=1.0
tried to run this command (copy-paste from the tutorial, ignore the line breaks in SO): mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeGroupId=org.apache.maven.archetypes -DinteractiveMode=false -DgroupId=com.example.employees -DartifactId=employees-app -DarchetypeVersion=1.0
- 命令输出: pastebin
- 输出摘要:
No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from therepositories [local (C:\Users\yogevl\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
- output from command: pastebin
- summary of the output:
No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from therepositories [local (C:\Users\yogevl\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
SO中的答案假设我有一个代理.我没有,我在此处进行了检查.另外,我可以使用Chrome访问 repo .另一个答案建议以管理员身份运行cmd.我做到了-同样的结果.
Answers in SO assumes I have a proxy. I don't, I checked it here. Plus, I am able to get to the repo using Chrome.Another answer advised to run the cmd as an Administrator. I did - same result.
在输出末尾,我还遵循了链接:
I also followed the link at the end of the output:
- 不这么认为,因为我是从托词复制粘贴的.
- 同上.
- 同上.
- 不确定这一点-settings.xml是默认文件.我需要更改吗?
- 与1-3相同.
谢谢您的帮助!
推荐答案
在此处阅读注释后,解决方案是更新cacerts文件,因为该文件缺少Maven存储库的正确证书(感谢I-LOVE-2-REVIVE (提供答案和链接).
After reading the comments here, the solution was to update the cacerts file, since it was lacking the proper certificate for the Maven repo (thanks I-LOVE-2-REVIVE for the answer and the link).
因此,如果您遇到与我相同的问题,请注意以下几点:
So, if you have the same problem I had, here some things:
- 此文章将指导您如何将证书添加到cacerts文件(再次,感谢I-LOVE-2-REVIVE的链接).确保为所需的存储库添加证书.
- 请记住,每个jdk/jde管理一个不同的证书列表.
- keytool位于
%JAVA_HOME%\bin
(起初我以为是linux shell工具,不是).
- This article will guide you how to add the certificate to the cacerts file (Again, thanks I-LOVE-2-REVIVE for the link). Make sure you add the certificate for the repo you need.
- Remember that each jdk/jde manages a different certificate list.
- The keytool is located at
%JAVA_HOME%\bin
(at first I thought it was a linux shell tool, it's not).
这篇关于Maven无法连接到存储库(我认为)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!