2016-09-23 4 views
1

일부 단위 테스트가 포함 된 Android 라이브러리 프로젝트가 있습니다. 테스트는 개발 기계 및 현장 연속 통합 기계를 실행하고 전달합니다. 이제 프로젝트의 호스트 저장소를 travis-ci (https://travis-ci.org/)에 연결하고 테스트를 실행하고 싶습니다.Travis-ci가 'test'작업을 찾지 못했습니다.

travis가 저장소에 액세스하여 각 푸시 할 때마다 빌드를 실행하도록 travis 계정을 설정했지만 travis가 실행하려는 gradle 작업을 찾지 못해 빌드가 실패합니다.

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
:

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 24 
    buildToolsVersion '24.0.2' 

defaultConfig { 
    minSdkVersion 14 
    targetSdkVersion 24 
    versionCode 1 
    versionName version 
    testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

testOptions { 
    unitTests.returnDefaultValues = true 
} 
} 



dependencies { 
     testCompile 'junit:junit:4.12' 
     testCompile 'org.mockito:mockito-core:1.10.19' 
     compile 'com.android.support:appcompat-v7:24.2.1' 
     androidTestCompile 'com.android.support.test:runner:0.5' 
     androidTestCompile 'com.android.support.test:rules:0.5' 
    } 

가 여기 내 루트 build.gradle 파일입니다 :

language: android 

before_install: 
- chmod +x gradlew 

script: ./gradlew :myproject:test 

android: 
    components: 
    # Uncomment the lines below if you want to 
    # use the latest revision of Android SDK Tools 
    - platform-tools 
    - tools 

    # The BuildTools version used by your project 
    - build-tools-24.0.2 

    # The SDK version used to compile your project 
    - android-24 

여기 내 응용 프로그램/build.gradle 파일입니다 :

이 내 .travis.yml 파일입니다

그리고 이것은 travis의 출력입니다 (불필요한 세부 사항은 제거했습니다) :

travis_time:end:05a1fcb0:start=1474639730310016962,finish=1474639745836305811,duration=15526288849 
[0Ktravis_fold:end:android.install 
[0K$ java -Xmx32m -version 
java version "1.7.0_76" 
Java(TM) SE Runtime Environment (build 1.7.0_76-b13) 
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode) 
$ javac -J-Xmx32m -version 
javac 1.7.0_76 
travis_fold:start:before_install 
[0Ktravis_time:start:01dad8c0 
[0K$ chmod +x gradlew 

travis_time:end:01dad8c0:start=1474639746648936514,finish=1474639746653023046,duration=4086532 
[0Ktravis_fold:end:before_install 
[0Ktravis_time:start:07b2b2a4 
[0K$ ./gradlew :myproject:test 
Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip 
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 
Unzipping /home/travis/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1-all.zip to /home/travis/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv 
Set executable permissions for: /home/travis/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/bin/gradle 
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html. 
Download https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.0/gradle-core-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/builder/2.2.0/builder-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/lint/lint/25.2.0/lint-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom 
Download https://jcenter.bintray.com/com/android/tools/build/gradle-api/2.2.0/gradle-api-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/databinding/compilerCommon/2.2.0/compilerCommon-2.2.0.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.4/asm-5.0.4.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.4/asm-parent-5.0.4.pom 
Download https://jcenter.bintray.com/org/ow2/ow2/1.3/ow2-1.3.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.pom 
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom 
Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.2.1/proguard-parent-5.2.1.pom 
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.pom 
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.build/0.7.5.201505241946/org.jacoco.build-0.7.5.201505241946.pom 
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.pom 
Download https://jcenter.bintray.com/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom 
Download https://jcenter.bintray.com/org/sonatype/oss/oss-parent/7/oss-parent-7.pom 
Download https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.pom 
Download https://jcenter.bintray.com/com/google/google/1/google-1.pom 
Download https://jcenter.bintray.com/org/antlr/antlr/3.5.2/antlr-3.5.2.pom 
Download https://jcenter.bintray.com/org/antlr/antlr-master/3.5.2/antlr-master-3.5.2.pom 
Download https://jcenter.bintray.com/org/sonatype/oss/oss-parent/9/oss-parent-9.pom 
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/2.2.0/builder-model-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/2.2.0/builder-test-api-2.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/sdklib/25.2.0/sdklib-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/sdk-common/25.2.0/sdk-common-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/common/25.2.0/common-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/25.2.0/manifest-merger-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/25.2.0/ddmlib-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.11.0/jack-api-0.11.0.pom 
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.10.0/jill-api-0.10.0.pom 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/protos/25.2.0/protos-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/shared/25.2.0/shared-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/tracker/25.2.0/tracker-25.2.0.pom 
Download https://jcenter.bintray.com/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom 
Download https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.pom 
Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.pom 
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/25.2.0/lint-checks-25.2.0.pom 
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.5.1/ecj-4.5.1.pom 
Download https://jcenter.bintray.com/com/google/guava/guava/17.0/guava-17.0.pom 
Download https://jcenter.bintray.com/com/google/guava/guava-parent/17.0/guava-parent-17.0.pom 
Download https://jcenter.bintray.com/com/android/databinding/baseLibrary/2.2.0/baseLibrary-2.2.0.pom 
Download https://jcenter.bintray.com/org/antlr/antlr4/4.5.3/antlr4-4.5.3.pom 
Download https://jcenter.bintray.com/org/antlr/antlr4-master/4.5.3/antlr4-master-4.5.3.pom 
Download https://jcenter.bintray.com/commons-io/commons-io/2.4/commons-io-2.4.pom 
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/25/commons-parent-25.pom 
Download https://jcenter.bintray.com/org/apache/apache/9/apache-9.pom 
Download https://jcenter.bintray.com/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.pom 
Download https://jcenter.bintray.com/com/android/tools/annotations/24.5.0/annotations-24.5.0.pom 
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.1/asm-parent-5.0.1.pom 
Download https://jcenter.bintray.com/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.pom 
Download https://jcenter.bintray.com/org/antlr/ST4/4.0.8/ST4-4.0.8.pom 
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/25.2.0/layoutlib-api-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/dvlib/25.2.0/dvlib-25.2.0.pom 
Download https://jcenter.bintray.com/com/android/tools/repository/25.2.0/repository-25.2.0.pom 
Download https://jcenter.bintray.com/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom 
Download https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom 
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/33/commons-parent-33.pom 
Download https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.1.1/httpcomponents-client-4.1.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom 
Download https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom 
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/25.2.0/lint-api-25.2.0.pom 
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.pom 
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.pom 
Download https://jcenter.bintray.com/com/google/jimfs/jimfs/1.1/jimfs-1.1.pom 
Download https://jcenter.bintray.com/com/google/jimfs/jimfs-parent/1.1/jimfs-parent-1.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-core/4.1/httpcomponents-core-4.1.pom 
Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom 
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/5/commons-parent-5.pom 
Download https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom 
Download https://jcenter.bintray.com/commons-codec/commons-codec/1.4/commons-codec-1.4.pom 
Download https://jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom 
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom 
Download https://jcenter.bintray.com/com/android/tools/external/com-intellij/uast/145.597.3/uast-145.597.3.pom 
Download https://jcenter.bintray.com/com/android/tools/annotations/25.2.0/annotations-25.2.0.pom 
Download https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom 
Download https://jcenter.bintray.com/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom 
Download https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.0/gradle-core-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/build/builder/2.2.0/builder-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/lint/lint/25.2.0/lint-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar 
Download https://jcenter.bintray.com/com/android/tools/build/gradle-api/2.2.0/gradle-api-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/databinding/compilerCommon/2.2.0/compilerCommon-2.2.0.jar 
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar 
Download https://jcenter.bintray.com/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.jar 
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.jar 
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.jar 
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.jar 
Download https://jcenter.bintray.com/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.jar 
Download https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar 
Download https://jcenter.bintray.com/org/antlr/antlr/3.5.2/antlr-3.5.2.jar 
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/2.2.0/builder-model-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/2.2.0/builder-test-api-2.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/sdklib/25.2.0/sdklib-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/sdk-common/25.2.0/sdk-common-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/common/25.2.0/common-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/25.2.0/manifest-merger-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/25.2.0/ddmlib-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.11.0/jack-api-0.11.0.jar 
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.10.0/jill-api-0.10.0.jar 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/protos/25.2.0/protos-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/shared/25.2.0/shared-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/analytics-library/tracker/25.2.0/tracker-25.2.0.jar 
Download https://jcenter.bintray.com/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar 
Download https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar 
Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar 
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.jar 
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/25.2.0/lint-checks-25.2.0.jar 
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.5.1/ecj-4.5.1.jar 
Download https://jcenter.bintray.com/com/android/databinding/baseLibrary/2.2.0/baseLibrary-2.2.0.jar 
Download https://jcenter.bintray.com/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar 
Download https://jcenter.bintray.com/commons-io/commons-io/2.4/commons-io-2.4.jar 
Download https://jcenter.bintray.com/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar 
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar 
Download https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.jar 
Download https://jcenter.bintray.com/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar 
Download https://jcenter.bintray.com/org/antlr/ST4/4.0.8/ST4-4.0.8.jar 
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/25.2.0/layoutlib-api-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/dvlib/25.2.0/dvlib-25.2.0.jar 
Download https://jcenter.bintray.com/com/android/tools/repository/25.2.0/repository-25.2.0.jar 
Download https://jcenter.bintray.com/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar 
Download https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar 
Download https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar 
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/25.2.0/lint-api-25.2.0.jar 
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar 
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.jar 
Download https://jcenter.bintray.com/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar 
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar 
Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 
Download https://jcenter.bintray.com/commons-codec/commons-codec/1.4/commons-codec-1.4.jar 
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar 
Download https://jcenter.bintray.com/com/android/tools/external/com-intellij/uast/145.597.3/uast-145.597.3.jar 
Download https://jcenter.bintray.com/com/android/tools/annotations/25.2.0/annotations-25.2.0.jar 
Download https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.jar 

FAILURE: Build failed with an exception. 

* What went wrong: 
Task 'test' not found in project ':myproject'. 

* Try: 
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 32.707 secs 

travis_time:end:07b2b2a4:start=1474639746657021455,finish=1474639780965732092,duration=34308710637 
[0K 
[31;1mThe command "./gradlew :myproject:test" exited with 1.[0m 

Done. Your build exited with 1. 

나는 gradle wrapper를 사용하지 않으려 고 노력했다.

어떤 아이디어가 잘못 되었나요?

답변

1

아마, 문제는이 라인에 있습니다

script: ./gradlew :myproject:test 

script: ./gradlew test 

또는

을 시도
script: ./gradlew :app:test 

업데이트 : 구문

로는 here 설명 :

는 특정 하위 프로젝트의 작업을 실행의 작업 경로를 지정합니다. 예를 들어 :

gradle :ABC:build 

루트 프로젝트의 주요 : 스탠드. ABC은 해당 프로젝트의 및 build 작업입니다. 또한

, 모든 모듈/하위 프로젝트에 원하는 작업을 실행 :

gradle build 

를 당신 만의 루트 프로젝트의 작업을 실행 here 주석으로 다음 형식을 사용해야하는 경우 :

gradle :build 
+0

나는 결국 사용했다./ gradlew jacocoTestReleaseUnitTestReport JaCoCo 플러그인을 사용하고 있지만 제안과 동일한 형식입니다. – barry

+0

예상되는 Gradle 형식에 대한 일반적인 설명을 추가했습니다. – albodelu

+0

어쨌든 'Travis-ci는'테스트 '작업을 찾을 수 없습니다. 대답은 정확했다. – albodelu

관련 문제