1

I used filteringCharset = 'UTF-8' because of encoding problems in ProcessResources in build.gradle. This build succeeded on my desktop, but failed on Travis CI. I guess this is the problem with Travis CI's Gradle. So I tried to update the version but could not find any information. Is this the problem with the Gradle version? If yes, what can I do?

Travis build error:

FAILURE: Build failed with an exception.
* Where:
Build file '/home/travis/build/EntryPointKR/K-Security/build.gradle' line: 43
* What went wrong:
A problem occurred evaluating root project 'K-Security'.
> No such property: filteringCharset for class: org.gradle.language.jvm.tasks.ProcessResources_Decorated

Full travis build log: https://travis-ci.org/EntryPointKR/K-Security/builds/201771722

.travis.yml:

language: java
sudo: false
jdk:
  - oraclejdk8
addons:
  apt:
    packages:
      - oracle-java8-installer

Problem code in build.gradle

processResources {
    filteringCharset = 'UTF-8' // Here
    filter ReplaceTokens, tokens: [
            "version"   : project.version,
            "pluginName": rootProject.name,
            "mainClass" : "cloud.swiftnode.ksecurity.KSecurity",
            "author"    : "EntryPoint"
    ]
}
Paul
  • 4,160
  • 3
  • 30
  • 56
Pneumono
  • 17
  • 1
  • 8

1 Answers1

0

This is very likely due to a mismatch between your gradle version and the gradle version installed in the java image. It was introduced in Gradle 2.14. The easiest fix is to use gradle wrapper to enforce the same version in both environments.

Simply add the wrapper task:

task wrapper(type: Wrapper) {
    gradleVersion = '3.3'
}

It should be possible to run gradle wrapper in before_install, or simply bundle the gradle-wrapper jar with your project. Travis CI will detect gradle wrapper and use gradlew instead of gradle.

If you are using Windows on your local machine, make sure you commit the gradlew script with executable flag.

Community
  • 1
  • 1
MartinTeeVarga
  • 10,478
  • 12
  • 61
  • 98