使用jenkins编译apk报错问题解决

之前项目可以正常在jenkins上构建,今天突然发现构建出错,问题如下:

Could not determine the dependencies of task ':lint'.
> Could not resolve all artifacts for configuration ':releaseUnitTestCompileClasspath'.
   > Could not resolve junit:junit:4.+.
     Required by:
         project :
      > Failed to list versions for junit:junit.
         > Unable to load Maven meta-data from http://jcenter.bintray.com/junit/junit/maven-metadata.xml.
            > Could not get resource 'http://jcenter.bintray.com/junit/junit/maven-metadata.xml'.
               > Could not GET 'https://jcenter.bintray.com/junit/junit/maven-metadata.xml'.
                  > org.apache.http.client.ClientProtocolException (no error message)
      > Skipped due to earlier error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

gradle插件版本4.1.2,gradle版本6.5

该问题的解决办法如下:

1、找到moudle的build.gralle文件

将 testImplementation 'junit:junit:4.+'改为testImplementation 'junit:junit:4.12'

2、在jenkins服务器使用的gradle编译文件找到如下地方,修改为以下信息

allprojects {
    repositories {
        jcenter { url "http://jcenter.bintray.com/"}
        google()
        maven { url 'http://repo1.maven.org/maven2' }
    }
}

然后重新使用jenkins构建,即可正常完成apk的构建了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
当在Jenkins使用管道执行Docker命令时,可能会遇到一些。其中两个常见的误是: 1. "Got permission denied":这个误是由于Jenkins用户没有执行Docker命令的权限导致的。解决方法是将Jenkins用户添加到docker组中,并重新启动Jenkins服务。可以使用以下命令实现: [usermod -a -G docker jenkins systemctl restart jenkins] 2. "touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied":这个误是由于Jenkins没有写入/var/jenkins_home/copy_reference_file.log文件的权限导致的。这可能是由于文件系统权限问题引起的。要解决这个问题,可以尝试更改文件系统的权限。请注意确保正确设置Jenkins Home目录的权限。 以上是两种常见的Jenkins管道Docker以及解决方法。希望对你有所帮助。 引用自 : 执行结果 出现“Got permission denied”,主要是权限问题jenkins pipeline是在master上执行的,Jenkins是由jenkins用户启动的,但是jenkins用户没有执行docker的权限,所以导致以上,所以我们的解决方法如下 $ usermod -a -G docker jenkins $ systemctl restart jenkins 引用自 : 这是因为jenkins默认使用jenkins用户操作,只需要将jenkins用户加入docker 组 dir('release') { sh "cat harbor_password.txt | docker login harbor-local.xxx.com --username admin --password-stdin" sh "docker build -t ${HARBOR_IMAGE} ." sh "docker push ${HARBOR_IMAGE}" sh "echo '$IMAGETAG' >> $JENKINS_HOME/workspace/CD/xxx-CD/DOCKER_TAGS" echo "===============Successfully pushed Docker Image ${HARBOR_IMAGE} .===============" echo "Cleaning up workspace..." cleanWs() } 引用自 : 如果 touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晒干的老咸鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值