简体   繁体   中英

How do I configure Travis CI build testing for a Java Eclipse project?

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?

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.

生成antfile对话框截图

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM