编译CM源码中遇到的一则Couldn't download artifact错误的解决方法

在编译Cyanogenmod 14.1源码过程中,遇到"Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin"错误,通过检查发现是Ubuntu系统对maven.cyanogenmod.org站点的信任问题。安装相关证书后,成功解决编译错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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后系统自动安装完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值