by JP
笔者最近为了纪念即将逝去的Cyanogenmod系统,特地找出尘封已久的Nexus4手机,下载了一份最新的CM14.1的源代码,想编译后安装使用。其过程在网络上有很多文章描述,在此就不赘述了。只是其间遇到了一个编译问题,折腾了几天,网上都没有翻到合适的方法;自行研究一番解决之后,不敢藏私,特地分享出来,供有需要的同好参考。
该问题编译出错的信息如下:
FAILED: /bin/bash -c "(mvn -q org.apache.maven.plugins:maven-dependency-plugin:2.10:get
....blar blar blar..............................................................................................................................................................
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
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): peer not authenticated[ERROR] org.cyanogenmod:gello:apk:40[ERROR][ERROR]
from the specified remote repositories:[ERROR] central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false),[ERROR] central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds, releases=true, snapshots=true)[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/MojoExecutionExceptionmake: *** [/home/xxx/android/moto/out/target/common/obj/APPS/Gello_intermediates/org.cyanogenmod.gello-40.apk] Error 1
起先看到“Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin”,以为是编译用的ubuntu系统没有安装最新版本maven,于是按照如下说明装上了3.3.1
sudo add-apt-repository ppa:natecarlson/maven3
apt-get update
apt-get install maven3
sudo ln -s /usr/bin/maven3 /usr/bin/mvn
装好后运行brunch mako还是报一样的错误,又仔细看了几眼,发现提示信息 “(https://maven.cyanogenmod.org/artifactory/gello_prebuilds):
peer not authenticated”,难道是没有权限?用ubuntu下的firefox浏览器打开https://maven.cyanogenmod.org/artifactory/gello_prebuilds站点,发现可以正常访问内容;突然联想到浏览器之前有提示过该站点为未信任网址,于是就猜测是否是ubuntu需要安装证书的原因,安装之后果然问题解决。
安装证书的步骤为:
0. 先确保firefox可以正常浏览https://maven.cyanogenmod.org/artifactory/gello_prebuilds;
1.访问浏览器的edit->preferences->Advanced->Encrytion->view certificates->server,在列表中找到*.cyanogemod.org这一栏,export该证书改名为.crt后缀文件;
2.将该文件拷贝到/usr/shared/ca-certificates下,建一个目录存放
3.shell下运行#dpkg-reconfigure ca-certificates,会弹出窗口,选择ok后在弹出列表中找到新的导入证书按空格选中,按ok后系统自动安装完成