Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven proxy settings not working

I have setup maven proxy settings in conf/settings.xml as

<proxy>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxy.my-company.com</host>
  <port>8080</port>
</proxy>

but when I run maven build, I am getting following error. Can someone please help

[WARNING] The POM for org.apache.maven.wagon:wagon-ssh:jar:2.2 is missing, no dependency information available

detailed log

mvn -X

Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\tools\apache-maven-3.0.4
Java version: 1.6.0_12, vendor: Sun Microsystems Inc.
Java home: C:\tools\Java\jdk1.6.0_12\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\tools\apache-maven-3.0.4\conf\settings.xml
[DEBUG] Reading user settings from C:\Documents and Settings\desibaba\.m2\settings.xml
[DEBUG] Using local repository at C:\Documents and Settings\desibaba\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Documents and Settings\desibaba\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo.maven.apache.org/maven2 via proxy.my-company.com:8080 as null
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.2/wagon-ssh-2.2.pom
[DEBUG] Writing resolution tracking file C:\Documents and Settings\desibaba\.m2\repository\org\apache\maven\wagon\wagon-ssh\2.2\wagon-ssh-2.2.pom.lastUpdated
[WARNING] The POM for org.apache.maven.wagon:wagon-ssh:jar:2.2 is missing, no dependency information available
[DEBUG] org.apache.maven.wagon:wagon-ssh:jar:2.2:
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.1:runtime
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo.maven.apache.org/maven2 via proxy.my-company.com:8080 as null
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.2/wagon-ssh-2.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[DEBUG] Writing resolution tracking file C:\Documents and Settings\desibaba\.m2\repository\org\apache\maven\wagon\wagon-ssh\2.2\wagon-ssh-2.2.jar.lastUpd
ated
[DEBUG] Writing resolution tracking file C:\Documents and Settings\desibaba\.m2\repository\org\codehaus\plexus\plexus-utils\1.1\plexus-utils-1.1.jar.last
Updated
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-ssh:2.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.wagon:wagon-ssh:jar:2.2, org.codehaus.plexus:plexus-utils:jar:1.1: Could not find artifact org.apache.maven.wagon:wagon-ssh:jar:2.2 in central (http://repo.maven.apache.org/maven2) @

        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
        at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR]
[ERROR]   The project xxx (C:\t1\9630727\pom.xml) has 1 error
[ERROR]     Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-ssh:2.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.wagon:wagon-ssh:jar:2.2, org.codehaus.plexus:plexus-utils:jar:1.1: Could not find artifact org.apache.maven.wagon:wagon-ssh:jar:2.2 in central (http://repo.maven.apache.org/maven2) -> [Help 2]
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.wagon:wagon-ssh:2.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.wagon:wagon-ssh:jar:2.2, org.codehaus.plexus:plexus-utils:jar:1.1: Could not find artifactorg.apache.maven.wagon:wagon-ssh:jar:2.2 in central (http://repo.maven.apache.org/maven2)
like image 589
Desi Baba Avatar asked Apr 05 '12 17:04

Desi Baba


People also ask

What is nonProxyHosts in settings xml?

The nonProxyHosts setting accepts wild cards, and each host not to proxy is separated by the | character. This matches the JDK configuration equivalent. Please note that currently NTLM proxies are not supported as they have not been tested.

Does Maven use system proxy?

By default, Maven will use the first active proxy definition it finds. Note that this is the protocol the proxy uses – the protocol of our requests (ftp://, http://, https://) is independent of this.

What is nonProxyHosts?

nonProxyHosts indicates the hosts which should be connected to directly and not through the proxy server. The value can be a list of hosts, each separated by a |, and in addition a wildcard character (*) can be used for matching. For example: -Dhttp.nonProxyHosts=*.foo.com|localhost|confluence|crowd.


1 Answers

I tried introducing the proxy settings to the settings.xml file in several different locations, but it seems like none of them were picked up during runtime.

However, I discovered that there is an environment variable MAVEN_OPTS where I was finally able to set the proxy info and have it reflected at runtime:

MAVEN_OPTS
-Dhttp.proxyHost=proxy.myproxy.com -Dhttp.proxyPort=80 -Dhttps.proxyHost=proxy.myproxy.com -Dhttps.proxyPort=80

Windows 7 System Variable Entry

like image 189
Matsu Q. Avatar answered Oct 12 '22 15:10

Matsu Q.