【发布时间】:2015-09-18 08:47:36
【问题描述】:
我有一个在 AWS 上工作的 pom.xml,但在工作代理后面却没有。我已经尝试了这篇帖子Maven proxy settings not working 中的所有内容,但没有任何效果。
这是使用 mvn help:effective-settings 的错误
...
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
Downloading:https://repo.maven.apache.org/maven2/org/codehaus/mojo/mavenmetadata.xml
Downloading:https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xmlfrom/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xmlfrom 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): repo.maven.apache.org
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml fromhttps://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 updatesare forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
...
[ERROR] No plugin found for prefix 'help' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\David.Wynter\.m2\repository),central(https://repo.maven.apache.org/maven2)] -> [Help 1]
这是我的 settings.xml 的相关部分
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>10.***.0.60</host>
<port>8080</port>
<username>dmgp\david.blow</username>
<password>*******</password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
主机等的设置来自适用于浏览器的 pac 文件。有什么想法吗?
我也试过添加这个
<extensions>
<extension>
<!-- this extension is required by wagon in order to pass the proxy -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<version>2.2</version>
</extension>
</extensions>
到我的 pom.xml 并将那个 jar 添加到我的 maven 安装 lib 目录中,但是得到了这个
[ERROR] Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-http-lightweight:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.wagon:wagon-http-lightweight:jar:2.2: Could not transfer artifact org.apache.maven.wagon:wagon-http-lightweight:pom:2.2 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 2]
【问题讨论】:
-
你有什么maven版本?
-
你不应该把那个 jar 添加到你的 repo 中吗? ,例如如果您的仓库位于 c:\users\
\.m2\repository\org\apache\maven\wagon\2.2\wagon-http-lightweight.jar -
使用“mvn -X”来检查你是否使用了正确的设置文件。执行命令后,您会看到很多信息,包括您是否使用了正确的文件,如下所示。 [调试] 从 /usr/java/apache-maven-3.0.3/conf/settings.xml 读取全局设置 [调试] 从 /home/myhome/.m2/settings.xml 读取用户设置