<p>The easiest method is to have Eclipse generate an Ant build script for you.</p>

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

<p><img src="https://i.sstatic.net/ssp3D.png" alt="Export menu screenshot"></p>

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

<p><img src="https://i.sstatic.net/W0WDU.png" alt="Generate antfile dialog screenshot"></p>

<p>Lastly, to ensure Travis CI runs the project correctly, <a href="https://docs.travis-ci.com/user/languages/java/" rel="noreferrer">create a .travis.yml in your project's root folder</a>. For Java projects, it should contain at least the following.</p>

<pre><code>language: java
jdk:
  - oraclejdk8

script: ant build
</code></pre>

<p>Source: <a href="http://kofun.pl/various/using-trvis-ci-with-java-eclipse-project/" rel="noreferrer">Kofun devblog - Using Travis CI with Java Eclipse Project</a></p>

CC BY-SA 3.0
2017-04-21T01:19:33.067Z
2017-05-11T01:00:12.257Z
2017-05-11T01:00:12.257Z
Stevoisiak
<p>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.</p>

<pre class="lang-none prettyprint-override"><code>Buildfile: build.xml does not exist!
Build failed

The command "ant test" exited with 1.
</code></pre>

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

<travis-ci><github><eclipse>
How do I configure Travis CI build testing for a Java Eclipse project?
Stevoisiak
# How do I configure Travis CI build testing for a Java Eclipse project?

(Asked by: username_0 on 2017-04-21)

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?

**Tags:** travis-ci, github, eclipse


---

## 1 answers

### Answer by username_0 on 2017-04-21. Score: 10 | Accepted answer

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


---

