2017-08-30 71 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

相关问题