Lately I came across travis-ci.org, which provides a free continuous integration service for projects hosted on Github. I wanted to try the service and thought it would be cool to have CI for the Eclipse EMF ProtoBuf Integration project. Unfortunately it was not that easy and took me a while to set up, but finally I managed.
The first problem was that there is no (or better: not yet) documentation about how to setup Java and Maven based projects. Fortunately there was a thread on the Travis mailing list mentioning support for JDK and Maven 2. Encouraged by this, I joined the Travis IRC channel and quickly got support from one of the Travis team members. It turned out that Java projects and Maven 3 are already (in-)officially supported. A minimal Travis build configuration file for a Java / Maven based project looks like:
language: java install: mvn install -DskipTests=true script: mvn test
The first build failed, because Tycho 0.12.0 was downloading the content of all the P2 repositories specified in the Eclipse target platform file and this exceeded the 15 minute time limit of Travis. Therefore, I switched to Tycho 0.13.0, which only downloads the required dependencies.
This lead to the second problem. Compiling the Acceleo templates during the build failed, because the template compiler depends on the org.eclipse.acceleo.parser plug-in, which is marked as optional in the MANIFEST.MF. But the new Tycho version refused to download optional dependencies. I found a bug report covering this topic. The report includes a workaround, so I could leave org.eclipse.acceleo.parser optional. The trick is to add the following line to the build.properties:
jars.extra.classpath = platform:/plugin/org.eclipse.acceleo.parser
The third problem came with the Protocol Buffers compiler. I already added a sudo apt-get install protobuf-compiler command to the Travis configuration, but due to the build box only running Ubuntu 11.04 this installed the 2.3.0 version of the compiler. This version generates source code incompatible to the 2.4.1 version of Protocol Buffers, I am using. After all this caused another failed build. Therefore, I had to add commands to build the right version of the Protocol Buffers compiler from source.
The last minor change was to replace mvn test with mvn integration-test, so the plug-in tests get executed.