[英]Gradle build failed on Travis CI
I used filteringCharset = 'UTF-8'
because of encoding problems in ProcessResources
in build.gradle
. 我使用
filteringCharset = 'UTF-8'
因为build.gradle
中的ProcessResources
中build.gradle
编码问题。 This build succeeded on my desktop, but failed on Travis CI. 这个构建在我的桌面上成功,但在Travis CI上失败了。 I guess this is the problem with Travis CI's Gradle.
我猜这是特拉维斯CI的Gradle的问题。 So I tried to update the version but could not find any information.
所以我尝试更新版本但找不到任何信息。 Is this the problem with the Gradle version?
这是Gradle版本的问题吗? If yes, what can I do?
如果是的话,我该怎么办?
Travis build error: Travis构建错误:
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构建日志: https : //travis-ci.org/EntryPointKR/K-Security/builds/201771722
.travis.yml: .travis.yml:
language: java
sudo: false
jdk:
- oraclejdk8
addons:
apt:
packages:
- oracle-java8-installer
Problem code in build.gradle build.gradle中的问题代码
processResources {
filteringCharset = 'UTF-8' // Here
filter ReplaceTokens, tokens: [
"version" : project.version,
"pluginName": rootProject.name,
"mainClass" : "cloud.swiftnode.ksecurity.KSecurity",
"author" : "EntryPoint"
]
}
This is very likely due to a mismatch between your gradle version and the gradle version installed in the java image. 这很可能是由于您的gradle版本与java映像中安装的gradle版本不匹配所致。 It was introduced in Gradle 2.14 .
它是在Gradle 2.14中引入的 。 The easiest fix is to use gradle wrapper to enforce the same version in both environments.
最简单的解决方法是使用gradle包装器在两个环境中强制执行相同的版本。
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. 应该可以在
before_install
运行gradle wrapper
,或者只是将gradle-wrapper jar与项目捆绑在一起。 Travis CI will detect gradle wrapper and use gradlew
instead of gradle
. Travis CI将检测gradle包装并使用
gradlew
而不是gradle
。
If you are using Windows on your local machine, make sure you commit the gradlew
script with executable flag . 如果您在本地计算机上使用Windows,请确保使用可执行标志提交
gradlew
脚本 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.