Home » Tools » Using Travis.CI with Java Eclipse Project

Using Travis.CI with Java Eclipse Project

Lately I set up Travis.CI for my Mavis project. It’s hosted continuous integration service free for open source projects. It’ll build your project and, optionally, run tests after every push to remote repository that contains travis.yml configuration file.

As I never really used ant or travis.ci before it took me too many hours to actually setup it correctly, so I figured I’ll share new knowledge.

All in all it’s really simple: just download your external libraries from online repository (i.e. maven’s repo1), and then copy libraries to proper folders, and build as normally you’d do with ant, or other build tool.

The catch is: I used eclipse without build automation system – and for travis it’s necessary to use one either gradle, maven or ant. Ok, so… what eclipse uses to manage building projects? Answer is: I don’t know. And Google isn’t helpful at all. Maybe I didn’t ask properly? Who knows?

Point is: to you can’t use eclipse project out of the box with Travis.ci. But it’s really easy to bypass it. Just ppm on project and select Export option from context menu, and then select general/Ant buildfiles to generate Ant file for given project.

Then add “download” target to get external libraries (in my case jfreechart library), and modify init target section to be dependable on previously created target, and add copying instruction.

Then generic travis.ci file will do all work to run project:

language: java
  - oraclejdk8

script: ant build
Posted in Tools, Various and tagged as , ,

Comments are closed.