如何设置Maven代理

时间:2022-05-23 11:50:05

1.公司的网络走的是代理,那么如何设置maven下载jar包时也走代理呢.

根据百度出来的两篇文章 设置了一下,但是还是报错.

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5:
Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2):
Not authorized by proxy , ReasonPhrase:Proxy Authentication Required. -> [Help ]

设置过程是按这篇博客操作的:  Maven代理设置

这个过程应该不存在什么问题,好多地方都是这么说,但在我还是无法下载jar包.原因是需要往maven中添加一个插件包

网上的描述如下:

It is probably an NTLM proxy? If it is:

Download the wagon-http-lightweight-2.2.jar from http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar

Copy the wagon-http-lightweight-2.2.jar to %M2_HOME%/lib/ext folder.

添加jar包后运行正常!