猿问

Maven 使用“mvn install”命令构建失败

我试图为 Cucumber-Maven 报告生成和测试我的代码(如果有效),然后打开命令提示符。我试过“mvn clean”,它是建立成功的。之后,我尝试了“mvn install”并遇到了BUILD FAILURE(显示错误)。


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  22.844 s

[INFO] Finished at: 2019-02-05T13:14:51+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.20 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.20: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.20 from/to central (https://repo.maven.apache.org/maven2): Connect to webproxy.sample.com:8080 [webproxy.sample.com/205.165.7.13] failed: Connection timed out: connect -> [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/PluginResolutionException


慕神8447489
浏览 207回答 2
2回答

慕容森

我尝试使用日食。我对同一个 POM 文件使用了 maven clean 和 install 。它工作正常。C:\users\youruser\.m2\settings.xml看来你的文件有问题。可能是阻止 maven 下载依赖项的代理问题。请检查您的 settings.xml 文件。

心有法竹

它看起来像代理问题,它阻止了依赖项的下载,所以settings.xml如果不存在,请进行一些更改或创建一个。去c:\users\youruser\.m2\settings.xml.<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; http://maven.apache.org/xsd/settings-1.0.0.xsd">&nbsp;<proxies>&nbsp; &nbsp; <proxy>&nbsp; &nbsp; &nbsp; <id>myproxy</id>&nbsp; &nbsp; &nbsp; <active>true</active>&nbsp; &nbsp; &nbsp; <protocol>http</protocol>&nbsp; &nbsp; &nbsp; <username>user</username>&nbsp; <!-- Put your username here -->&nbsp; &nbsp; &nbsp; <password>pass</password>&nbsp; <!-- Put your password here -->&nbsp; &nbsp; &nbsp; <host>123.45.6.78</host>&nbsp; &nbsp;<!-- Put the IP address of your proxy server here -->&nbsp; &nbsp; &nbsp; <port>80</port>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <!-- Put your proxy server's port number here -->&nbsp; &nbsp; &nbsp; <nonProxyHosts>maven</nonProxyHosts> <!-- Do not use this setting unless you know what you're doing. -->&nbsp; &nbsp; </proxy>&nbsp; &nbsp;&nbsp;&nbsp; </proxies>&nbsp;</settings>
随时随地看视频慕课网APP

相关分类

Python
我要回答