Maven not using proxy in pom.xml for remote repositories -


i using maven build code , inside project pom.xml, have configured remote repository as

 <repositories>    <repository>    <releases>    <enabled>true</enabled>    <updatepolicy>always</updatepolicy>    <checksumpolicy>warn</checksumpolicy>    </releases>    <snapshots>    <enabled>false</enabled>    <updatepolicy>never</updatepolicy>    <checksumpolicy>fail</checksumpolicy>    </snapshots>    <id>hdpreleases</id>    <name>hdp releases</name>    <url>http://repo.hortonworks.com/content/repositories/releases/</url>    <layout>default</layout>    </repository>    </repositories> 

and in maven setting.xml have added details under proxy tag https requests use proxy while downloading. maven fails required files remote hortonworks repository , fail error like

[error] failed execute goal on project flume-sources: not resolve dependencies project com.hdptest:flume-sources:jar:1.0-snapshot: failed collect dependencies @ org.apache.flume:flume-ng-core:jar:1.4.0.2.0.10.1-3: failed read artifact descriptor org.apache.flume:flume-ng-core:jar:1.4.0.2.0.10.1-3: not transfer artifact org.apache.flume:flume-ng-core:pom:1.4.0.2.0.10.1-3 from/to hortonworks (http://repo.hortonworks.com/content/repositories/releases/): connect repo.hortonworks.com:80 [repo.hortonworks.com/54.225.131.199] failed: connection timed out -> [help 1] 

i can understand here problem. whenever maven tries download repo.hortonworks.com, doesn't use proxy details have mentioned inside settings.xml , therefore request not working. when passes same request maven

this clear looking @ debug messages maven build shown below. while downloading https://repo.maven.apache.org, uses correct proxy details. when downloaded repository of hortonworks, failes use proxy.:

[debug] ======================================================================= [debug] using transporter wagontransporter priority -1.0 http://repo.hortonworks.com/content/repositories/releases/ [debug] using connector basicrepositoryconnector priority 0.0 http://repo.hortonworks.com/content/repositories/releases/ downloading: http://repo.hortonworks.com/content/repositories/releases/org/apache/flume/flume-ng-core/1.4.0.2.0.10.1-3/flume-ng-core-1.4.0.2.0.10.1-3.pom [debug] writing tracking file /root/.m2/repository/org/apache/flume/flume-ng-core/1.4.0.2.0.10.1-3/flume-ng-core-1.4.0.2.0.10.1-3.pom.lastupdated [debug] using transporter wagontransporter priority -1.0 https://repo.maven.apache.org/maven2 [debug] using connector basicrepositoryconnector priority 0.0 https://repo.maven.apache.org/maven2 via xyzproxy.test.co.in:8080 username=proxy_user_name, password=*** downloading: https://repo.maven.apache.org/maven2/org/apache/flume/flume-ng-core/1.4.0.2.0.10.1-3/flume-ng-core-1.4.0.2.0.10.1-3.pom [debug] writing tracking file /root/.m2/repository/org/apache/flume/flume-ng-core/1.4.0.2.0.10.1-3/flume-ng-core-1.4.0.2.0.10.1-3.pom.lastupdated 

so solution make sure maven use given proxy each , every http requests? http request repository set inside project pom.xml. here http url accessible outside pom file present.

i tried adding mirror same hortonworks repository inside setting.xml maven use proxy details while looking @ mirror site. not working.

  <mirror>       <id>hortonworks</id>       <mirrorof>hdpreleases</mirrorof>       <name>using mirror hortonworks.</name>       <url>http://repo.hortonworks.com/content/repositories/releases/</url>     </mirror> 

note proxy settings correct , maven using them download other files https://repo.maven.apache.org. if remove proxy settings file, clear error maven unable connect repo. means using correct settings.xml file , not issue proxy settings incorrect.

only issue maven not using proxy httpsrequests remote repositories url.

i solve issue. aware issue company proxy had added required proxy details username , password in maven settings.xml. setting not getting used when define repository inside pom.xml.

so solution worked me set cntlm on vm , point proxy inside settings.xml localhost:3128. after https request vm goes localhost:3128 , issue solved.

entry in maven settings.xml this

<proxies>    <proxy>       <active>true</active>       <protocol>http</protocol>       <host>localhost</host>       <port>3128</port>       <nonproxyhosts>127.0.0.1</nonproxyhosts>    </proxy> </proxies> 

Comments