我在编译Nexus 5X cm13时,遇到了maven拉取一个apk总是Timeout.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:get (default-cli) on project standalone-pom: Couldn't download artifact: Could not transfer artifact org.cyanogenmod:gello:apk:40 from/to central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds): GET request of: org/cyanogenmod/gello/40/gello-40.apk from central failed
[ERROR] org.cyanogenmod:gello:apk:40
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds, releases=true, snapshots=true): Read timed out
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
vendor/cm/build/core/maven_artifact.mk:42: recipe for target '/home/android/source/outdir/cm/target/common/obj/APPS/Gello_intermediates/org.cyanogenmod.gello-40.apk' failed
make: *** [/home/android/source/outdir/cm/target/common/obj/APPS/Gello_intermediates/org.cyanogenmod.gello-40.apk] Error 1
make: Leaving directory '/home/android/source/cm'
解决方案:设置maven http代理
修改maven配置文件 ~/.m2/settings.xml, 如果没有该文件,就新建一个,内容如下:
<settings>
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>127.0.0.1</host>
<port>1080</port>
</proxy>
</proxies>
</settings>
host:代理服务器的地址
port:代理服务器的端口