11

I have an Eclipse Java project on GitHub. I would like to set up auto-build testing with Travis CI. However, when I enable build testing for my project, compilation always fails with the following error.

Buildfile: build.xml does not exist!
Build failed

The command "ant test" exited with 1.

How do I configure Travis CI to run build tests for my Java Eclipse project?

1 Answer 1

10

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.

Export menu screenshot

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.

Generate antfile dialog screenshot

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.