Travis Continuous Integration Fails

My Travis builds worked nicely until I start to add a java/groovy Swing view or GUI to my projects. The gradle tests run and pass locally, but Travis throws a java.awt.HeadlessException as soon as it tried to run the test suite.

The Travis docs suggest using a tool called xvfb (X Virtual Framebuffer) to simulate a windowing system and run headless tests, but also warn “you need to tell your testing tool process” exactly how to use it.

The solution is simple: just add a few arguments to .travis.yml file. Mine looks like this:

language: java
before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
jdk:
  - oraclejdk7
  - openjdk7
  - openjdk8

IBM360

Nice 😉