2013年10月13日日曜日

Pitfall of using gradle-cobertura-plugin in Travis-CI

(This post will soon be obsolete.)

In Travis-CI, oracle jdk version is 1.7 and gradle version is 1.6. That's ok. But using with gradle-cobertura-plugin, there is a problem.

gradle-cobertura-plugin 1.x only works with java 1.6 and below, so it doesn't work in Travis-CI because its oracle jdk is 1.7.

gradle-cobertura-plugin 2.x only works with gradle 1.7 and above, so it doesn't work in Travis-CI because its gradle is 1.6.

So if you want to use gradle-cobertura-plugin in Travis-CI, following .travis.yml trick will help:

before_install:
# use Gradle 1.7 
- wget http://services.gradle.org/distributions/gradle-1.7-bin.zip
- unzip gradle-1.7-bin.zip
- export GRADLE_HOME=$PWD/gradle-1.7
- export PATH=$GRADLE_HOME/bin:$PATH

Add above lines to the .travis.yml and the build run with local gradle 1.7. So in this settings gradle-cobertura-plugin 2.x works fine with Travic-CI.

See example at https://github.com/kt3k/straw-android-plugin

Have a good test run!

0 件のコメント:

コメントを投稿