如何修复tavis build中的权限被拒绝问题

时间:2016-12-25 12:34:39

标签: gradle build.gradle travis-ci

我正在尝试将我的java项目构建与gradle与sonarqube附加组件集成在travis下面是我的脚本,当我提交任何travis构建被触发但它失败并且权限被拒绝错误。如何克服这个错误?

language: java
sudo: false
install: true

addons:
  sonarqube:
    token:
      secure: "q2nz2BsoZpki0kNkvieSv3UVBu0O93kOXzcyYcRBrz7QTchJ8ma5WDX/ZMAYiC2BZDZDXWSO7mh88pbWUpRPUgsmU1hRTUltRUPqUv2RIlfy88eZefdCLGRfOiDpvrBVBCROiBygQMO1VPj4b3NSxjYwK7I89a5IS8UuYc2DLM+7yv5xLOLLjmK42HU28Z/5TNjjHKaPjY6Oem5H5KHf5CP3ZMqrSkSn4dvQIIowmOISlgbc0TYBTBiJnpwTwfgyS1oPjkMhwMvGxGoPZONIsmUBEH+kZSJMTomM+HS3YoAai4ZuFOodr5H+b2LItSBPXMBQV4DRX3QTW2On4Oz+UnLK2w9QBZ0KgE1dJqPD/y8N4jbs6ef2xBhviWYeAn+NMg1pluq/1VmUbsm7J0ocsSzilQpkMFYreIHZtIDluvLogBznzw2CSRUMhZg2fq+DFydLMvLFhxjbI8z9F7+IVl2P0NAUuh3fKqZAXshPN2Sofp+PfEP4VLyv6EhBonjngIbnNB5fOEyUW1a6QwT7IABDV3dD7kFYyoPAdekMpEFzwlljZjimCa6e7OPW1Lo9vv8CpSz4ggqXzf8hjleJkJ3XnEfM7h2dv943/aCS1wE5K4641rr5klrbIJk+/pmiCmBON/ccpbbV1eLpDnFLai1rCnstIH0j7Dz2L6BOJYY="

jdk:
  - oraclejdk8

script:
  - ./gradlew sonarqube

cache:
  directories:
    - '$HOME/.m2/repository'
    - '$HOME/.sonar/cache'
    - '$HOME/.gradle'
    - '.gradle'

notifications:
  email: false

我的日志

Worker information
hostname: ip-10-12-6-59:ef24a578-e5d1-4580-a6a8-03124000caa1
version: v2.5.0-8-g19ea9c2 https://github.com/travis-ci/worker/tree/19ea9c20425c78100500c7cc935892b47024922c
instance: 03a5439:travis:java
startup: 2.389915121s
Build system information
Build language: java
Build group: stable
Build dist: precise
Build id: 186641574
Job id: 186641575
travis-build version: 7cac7d393
Build image provisioning date and time
Thu Feb  5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"

$ export DEBIAN_FRONTEND=noninteractive
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_restricted_binary-amd64_Packages.gz is not what the server reported 19576 20785
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_restricted_binary-i386_Packages.gz is not what the server reported 19521 20707
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-backports_multiverse_source_Sources.gz is not what the server reported 5886 5888
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_travis-ci_zero-mq_ubuntu_dists_precise_main_binary-amd64_Packages.gz is not what the server reported 832 1195
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-amd64_Packages.gz is not what the server reported 33653 36677
W: Size of file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_precise-security_restricted_binary-amd64_Packages.gz is not what the server reported 13782 14904
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-i386_Packages.gz is not what the server reported 33699 36733
W: Size of file /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_precise-security_restricted_binary-i386_Packages.gz is not what the server reported 13751 14885
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libc-bin libc-dev-bin libc6-dev
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc-bin libc-dev-bin libc6 libc6-dev
4 upgraded, 0 newly installed, 0 to remove and 267 not upgraded.
Need to get 8,840 kB of archives.
After this operation, 14.3 kB disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.15 [2,943 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.15 [84.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.15 [1,177 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.15 [4,636 kB]
Fetched 8,840 kB in 0s (30.7 MB/s)
Preconfiguring packages ...
(Reading database ... 72019 files and directories currently installed.)
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.15-0ubuntu10.15) ...
(Reading database ... 72018 files and directories currently installed.)
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.15-0ubuntu10.15) ...
Setting up libc-dev-bin (2.15-0ubuntu10.15) ...
Setting up libc6-dev (2.15-0ubuntu10.15) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
$ git clone --depth=50 --branch=master https://github.com/rajadilipkolli/secure-ecommerce.git rajadilipkolli/secure-ecommerce
Cloning into 'rajadilipkolli/secure-ecommerce'...
remote: Counting objects: 97, done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 97 (delta 35), reused 59 (delta 1), pack-reused 0
Unpacking objects: 100% (97/97), done.
Checking connectivity... done.

$ cd rajadilipkolli/secure-ecommerce
$ git checkout -qf 3a028e7b2153c3f2145e53095f7e763f9c4ee22b

This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
$ jdk_switcher use oraclejdk8
Switching to Oracle JDK8 (java-8-oracle), JAVA_HOME will be set to /usr/lib/jvm/java-8-oracle
$ export TERM=dumb
Setting up build cache
$ export CASHER_DIR=$HOME/.casher
$ Installing caching utilities


attempting to download cache archive
fetching master/cache-linux-precise-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--jdk-oraclejdk8.tgz
found cache


adding /home/travis/.m2/repository to cache
adding /home/travis/.sonar/cache to cache
creating directory /home/travis/.sonar/cache
adding /home/travis/.gradle to cache
creating directory /home/travis/.gradle
adding /home/travis/build/rajadilipkolli/secure-ecommerce/.gradle to cache
creating directory /home/travis/build/rajadilipkolli/secure-ecommerce/.gradle
repository is not yet cached

$ java -Xmx32m -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
$ javac -J-Xmx32m -version
javac 1.8.0_31
$ true

SonarQube addon
addon hash: 187bb90a8521235b4b8c8a4e70fb431b
Preparing SonarQube Scanner CLI
Archive:  /home/travis/.sonarscanner/sonar-scanner.zip
   creating: /home/travis/.sonarscanner/sonar-scanner-2.8/
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-scanner.bat  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-scanner-debug  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/lib/sonar-scanner-cli-2.8.jar  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-scanner  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-runner.bat  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-runner  
  inflating: /home/travis/.sonarscanner/sonar-scanner-2.8/bin/sonar-scanner-debug.bat  
$ export SONAR_SCANNER_HOME=$HOME/.sonarscanner/sonar-scanner-2.8
Not installing SonarSource build-wrapper because it's a Java or Javascript project
Preparing SonarQube Scanner parameters
$ ./gradlew sonarqube
/home/travis/build.sh: line 57: ./gradlew: Permission denied


The command "./gradlew sonarqube" exited with 126.
store build cache

nothing changed, not updating cache


Done. Your build exited with 1.

1 个答案:

答案 0 :(得分:0)

看起来文件gradlew没有设置权限位。您可以通过执行以下操作来验证这一点:

install:
  - chmod +x gradlew

如果这样做,您可能需要在存储库中设置权限位并删除上面的配置。