How do I configure Travis CI build testing for a Java Eclipse project?
The easiest method is to have Eclipse generate an Ant build script for you.

Right click on your project in the Package Explorer and select Export in the context menu. Choose the export type General -> Ant Buildfiles and click Next.



On the next screen, make sure your project is selected. You can keep leave the options on their default settings. Click Finish to generate your build.xml file.



Lastly, to ensure Travis CI runs the project correctly, create a .travis.yml in your project's root folder. For Java projects, it should contain at least the following.

language: java
jdk:
  - oraclejdk8

script: ant build


Source: Kofun devblog - Using Travis CI with Java Eclipse Project