2017-08-30 430 views
0

我有多個maven問題。我在這裏提出一個問題。由於maven插件,無法從命令提示符創建Maven項目

我試圖從命令提示符創建一個maven項目。我正在構建失敗。我已經嘗試了多種解決方案,這些解決方案都是在stackoverflow以及其他網站上推薦的。以下是環境詳細信息,

Java - 1.8 
Eclipse - Oxygen 
Maven - 3.5 
OS - Windows 

當我運行mvn -version時,我在命令提示符下得到了下面的結果。

D:\WS-Gradle-1563>mvn -version 

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T01:09:06+05:30) 
Maven home: C:\apache-maven-3.5.0\bin\.. 
Java version: 1.8.0_121, vendor: Oracle Corporation 
Java home: C:\Program Files\Java\jdk1.8.0_121\jre 
Default locale: en_IN, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" 

符合maven安裝程序是正確的,我已經運行這個命令來創建一個maven項目。

D:\WS-Gradle-1563>mvn archetype:generate -DgroupId=com.maven.example -DartifactId=MavenExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

在這裏,我不明白一件事,爲什麼默認情況下,插件版本是這樣的。即使我也嘗試從eclipse中,我得到與插件(編譯器/資源)相關的pom.xml文件中的錯誤。我得到的輸出如下所示。

[INFO] Scanning for projects... 
Downloading: 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: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.3: Plugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.3 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.8: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.3.2: Plugin org.apache.maven.plugins:maven-release-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.3.2 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml 
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml 
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/ to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
[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): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
[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): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
[INFO] --------------------------------------------------------------------- 
[INFO] BUILD FAILURE 
[INFO] --------------------------------------------------------------------- 
[INFO] Total time: 7.771 s 
[INFO] Finished at: 2017-08-30T14:54:49+05:30 
[INFO] Final Memory: 9M/123M 
[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\A8197\.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 

在Eclipse中,我得到這種類型的錯誤。

Error in POM.XML file

在庫中,默認情況下它是下載與情人版本的插件。我不明白我在哪裏禁用配置並下載配置版本的插件。你能幫助我嗎?

我試圖下載基於Maven Plugin versions.

但插件,不能夠這樣做。

+0

的可能的複製[Maven的:PKIX路徑建設失敗] (https://stackoverflow.com/questions/33676059/maven-pkix-path-building-failed) – glytching

+0

我不確定,但您可以嘗試刪除您的.m2目錄並重新生成示例應用程序。 – z21

+0

你有上網嗎?你可以從瀏覽器訪問https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom嗎? – robjwilkins

回答

1

您是否使用代理服務器支持某些公司網絡? 如果是這樣,嘗試添加代理向您詳細的settings.xml,你會發現/在.m2目錄目錄或在您的MAVEN_HOME/conf目錄/目錄下創建這個文件

<proxies> 
<proxy> 
    <id>proxy-http</id> 
    <active>true</active> 
    <protocol>http</protocol> 
    <host>your proxy url</host> 
    <port>80</port> 
    <username>userid if your proxy needs one</username> 
    <password>your password</password> 
    <nonProxyHosts>if you wish to configure non proxy urls</nonProxyHosts> 
</proxy> 
</proxies> 
+0

謝謝venkat,我還沒有得到代理的細節。但是,我們公司已經配置了我們自己的倉庫。有一次,我在Settings.xml中更改了我能夠解決這些問題。似乎,你的評論也是有效的,所以+1。 – SubbaReddy

相關問題