Travis CI无法使用gradle包装器解压缩gradle 1.11

时间:2014-04-10 08:55:58

标签: gradle java-8 travis-ci gradlew

从今天开始,我的一个项目的构建在Travis CI上失败,因为解压缩gradle 1.11存在问题。这适用于较新的构建以及几天前执行的旧构建。 gradlew assemble在我的本地计算机上工作正常,只在Travis CI上失败。 The output of the build is the following

Using worker: worker-linux-6-2.bb.travis-ci.org:travis-linux-9

$ git clone --depth=50 --branch=master git://github.com/lenhard/pete.git lenhard/pete
Cloning into 'lenhard/pete'...
remote: Counting objects: 779, done.
remote: Compressing objects: 100% (567/567), done.
remote: Total 779 (delta 325), reused 571 (delta 134)
Receiving objects: 100% (779/779), 4.20 MiB | 0 bytes/s, done.
Resolving deltas: 100% (325/325), done.
Checking connectivity... done.
$ cd lenhard/pete
$ git checkout -qf 5bef29676d981c7de80517950cbb9b1bb85bba00
$ jdk_switcher use oraclejdk8
Switching to Oracle JDK8 (java-8-oracle), JAVA_HOME will be set to /usr/lib/jvm/java-8-oracle
update-alternatives: error: no alternatives for apt.
$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b128)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b69, mixed mode)
$ javac -version
javac 1.8.0
before_install
$ chmod +x gradlew
$ ./gradlew assemble
Downloading http://services.gradle.org/distributions/gradle-1.11-bin.zip

Unzipping /home/travis/.gradle/wrapper/dists/gradle-1.11-bin/4h5v8877arc3jhuqbm3osbr7o7/gradle-1.11-bin.zip to /home/travis/.gradle/wrapper/dists/gradle-1.11-bin/4h5v8877arc3jhuqbm3osbr7o7
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at org.gradle.wrapper.Install.unzip(Install.java:148)
at org.gradle.wrapper.Install.createDist(Install.java:65)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:47)

Travis试图重复gradlew assemble两次,但最终失败了。我的.travis.yml非常简单:

language: java
jdk:
  - oraclejdk8

before_install:
 - chmod a+x gradlew

这个问题可以从何而来?从我的机器访问http://services.gradle.org/distributions/gradle-1.11-bin.zip时,我得到一个可以解压缩并正常工作的正确分发版。这可能与我使用JDK 1.8的事实有关吗?

1 个答案:

答案 0 :(得分:2)

问题既不是由特拉维斯CI引起的,也不是由项目配置引起的。相反,似乎gradle包装器在重定向新主机后出现问题。这来自于在gradle.org上为包装器启用https下载。这个问题已经解决了,现在一切都恢复了正常。

More info on this problem can be found in the gradle forums.