2016-08-01 101 views
0

我正在使用提供的make文件安裝軟件(Apache Thrift)。當我每運行指南進行,我得到:Maven,Ant(或Apache Thrift)在make期間超時。在哪裏放置代理設置?

Buildfile: /home/john/thrift/lib/java/build.xml 

setup.init: 

mvn.ant.tasks.check: 

proxy: 

mvn.ant.tasks.download: 
     [get] Getting: http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar 
     [get] To: /home/john/thrift/lib/java/build/tools/maven-ant-tasks-2.1.3.jar 

mvn.init: 
[artifact:dependencies] [WARNING] Overriding profile: 'maven-ant-tasks-repo-profile' (source: pom) with new instance from source: pom 
[artifact:dependencies] Downloading: org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.pom from repository central at http://repo1.maven.org/maven2 
[artifact:dependencies] Error transferring file: Connection timed out 

它肯定看起來像代理問題,所以我在行家的conf文件/usr/share/maven2/conf/settings.xml配置我的代理設置。當未仍能正常工作,從終端,我

export ANT_OPTS="-Dhttp.proxyHost=[MyProxyName] -Dhttp.proxyPort=[MyProxyPort] -Dhttps.proxyHost=[MyProxyName] -Dhttps.proxyPort=[MyProxyPort]"

,並再次運行make。這次我過去了mvn.ant.tasks.download以上的行,但是mvn.init超時了。

什麼是設置代理設置的適當位置,以便Maven和Ant可以獲取這些設置?或者也許在Thrift配置文件,.pom文件或類似的東西中指定這些設置?提前致謝!

回答

0

問題已解決。你可以在〜/ .m2/settings.xml中設置代理設置。

<settings> 
    <proxies> 
    <proxy> 
     <id>http_proxy</id> 
     <active>true</active> 
     <protocol>http</protocol> 
     <host>YOUR_HOST</host> 
     <port>YOUR_PORT</port> 
     <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts> 
    </proxy> 
    </proxies> 
</settings>