We use an older version of gradle which is determined to use jcenter (which surprisingly is still around but occasionally has issues). When I updated our gradle build to have
hosts: - https://jcenter.bintray.com
so we could ensure we would not inadvertently use jcenter. However, when I do this, I started seeing gradle build failing after compilation with
Could not stop org.gradle.internal.build.event.DefaultBuildEventsListenerRegistry$ForwardingBuildEventConsumer@a46dd39. org.gradle.api.UncheckedIOException: java.net.UnknownHostException: travis-job-cmus-data-xchange-76366469: travis-job-cmus-data-xchange-76366469: Name or service not known
I thought perhaps something was going wrong with the hosts file, so I added
- ls -alt /etc/hosts - sudo chmod +r /etc/hosts - sudo cat /etc/hosts
to my travis.yaml. However, they “succeed” with the following errors:
$ ls -alt /etc/hosts -rw-r--r-- 1 root root 0 Sep 26 14:42 /etc/hosts install.2 0.03s$ sudo chmod +r /etc/hosts sudo: unable to resolve host travis-job-cmus-data-xchange-76366469 install.3 0.03s$ sudo cat /etc/hosts sudo: unable to resolve host travis-job-cmus-data-xchange-76366469
I unfortunately cannot provide a link to the build, as it is in a private travis repository my company hosts.
Here’s the .travis.yml up to the point it fails. Note this passes if I remove the
hosts block. I don’t think the actual code is relevant. If there’s anything else I can provide, please let me know.
language: java sudo: required dist: xenial services: - docker network: bluezone addons: hosts: - https://jcenter.bintray.com git: depth: 6 install: #Run code compilation here. If it fails, the build fails immediately - ls -alt /etc/hosts - sudo chmod +r /etc/hosts - sudo cat /etc/hosts - ./gradlew shadowJar
Here shadowJar comes from
id 'com.github.johnrengelman.shadow' version '5.1.0'