从今天开始,由于解压缩gradle 1.11中的问题,我的一个项目的构建在Travis CI上失败了。这适用于几天前执行的新版本以及旧版本。 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的事实有关吗?

最佳答案

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

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

07-24 09:47
查看更多