Java Maven 构建依赖项失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18590506/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven build failing on dependencies
提问by Rhyso
I have a local artefact repository which my maven settings are pointed at but for some reason this doesn't seem to hit it, and fails all the time when trying to do an install. I can access the url directly in my browser and can also access the maven repo via browser. I can also ping both.
我有一个本地人工制品存储库,我的 Maven 设置指向它,但由于某种原因,这似乎没有命中它,并且在尝试安装时总是失败。我可以直接在浏览器中访问 url,也可以通过浏览器访问 maven repo。我也可以ping通。
Any ideas why it keeps failing? Stack trace below
任何想法为什么它总是失败?下面的堆栈跟踪
Cheers,
干杯,
mvn clean install -DskipTests -T 8C
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project uk.co.three:Three:0.1 (/Users/***/Projects/three/Development/pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-webdav:1.0-beta-2 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2 (): Failed to read artifact descriptor for org.apache.maven.wagon:wagon-webdav:jar:1.0-beta-2: Could not transfer artifact org.apache.maven.wagon:wagon-webdav:pom:1.0-beta-2 from/to central (http://repo1.maven.org/maven2): Error transferring file: Connection refused -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
采纳答案by Volker Seibt
I don't know if you used the embedded or an external maven installation (Window-> Preferences -> Maven -> Installations).
我不知道您是使用嵌入式还是外部 maven 安装(Window-> Preferences -> Maven -> Installations)。
If it's external you have to declare your corporate proxy in the settings.xml
(in the conf folder of your external installation or in your local repository).
如果它是外部的,则必须在settings.xml
(在外部安装的 conf 文件夹中或在本地存储库中)声明您的公司代理。
It may be also the case if you use the embedded maven. Then you have to provide a settings file in "Global settings for embedded installation".
如果您使用嵌入式 maven,情况也可能如此。然后您必须在“嵌入式安装的全局设置”中提供一个设置文件。
If you are using an external maven installation you can also try the command line outside eclipse.
如果您使用的是外部 maven 安装,您还可以在 eclipse 之外尝试命令行。
With
和
mvn -U ...
You can force maven to look for the latest plugin versions.
您可以强制 maven 查找最新的插件版本。
回答by Amin Abu-Taleb
Try to set up your eclipse's proxy configuration in
尝试在
Settings -> General -> Network Connection
Settings -> General -> Network Connection
and try again, it seems to be a matter of visibility.
再试一次,这似乎是一个能见度的问题。
回答by Sajan Chandran
If you are behind the proxy, you can use
如果您在代理后面,则可以使用
mvn clean install -DproxySet=true -DproxyHost=<your proxy host> -DproxyPort=<port>
mvn clean install -DproxySet=true -DproxyHost=<your proxy host> -DproxyPort=<port>
回答by Vijay C
If you are using proxy and you have unzipped the Maven directory, then update settings.xml in {APACHE_MAVEN_DIR}\conflike below,
如果您使用的是代理并且您已经解压了 Maven 目录,那么更新{APACHE_MAVEN_DIR}\conf 中的settings.xml,如下所示,
just update the "REPLACE~~"strings with the proper info, and try again.
只需使用正确的信息更新“REPLACE~~”字符串,然后重试。
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
Here is the official documentation for proxy configuration in maven settings.xml:
以下是 maven settings.xml 中代理配置的官方文档:
回答by prabhugs
You can also try running the below command from withing your project,
您也可以尝试在您的项目中运行以下命令,
$ git config --global url."https://".insteadOf git://