Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI With Ant Build, Not Finding JUnit

I'm trying to figure out how to get Travis CI working with my little Java library on Github.

The problem seems to be that whenever the build process gets to the compilation stage, it won't compile the unit tests because it can't seem to find the JUnit jar file. Of course the Ant script works beautifully on my own computer, but I can't get the classpath right on Travis. How am I supposed to know where (or even if) they installed JUnit?

Here's my Ant script:

<project>
    <target name="test">
        <delete dir="build" />

        <mkdir dir="build" />
        <javac includeantruntime="false" srcdir="src" destdir="build" />
        <javac includeantruntime="false" srcdir="tests" destdir="build" classpath="/usr/share/java/junit.jar" />

        <junit printsummary="on">
            <classpath>
                <pathelement location="build" />
                <pathelement path="/usr/share/java" />
            </classpath>
            <test name="FactorizeTest" />
        </junit>
    </target>
</project>

Here's the project link, notice the pretty "build failing" icon. Yay.
https://github.com/The-Craw/PrimeFactorizer

And finally here's the link to the build output. You can also get this from clicking the build icon.
https://travis-ci.org/The-Craw/PrimeFactorizer

like image 979
Scotty C. Avatar asked Sep 06 '13 06:09

Scotty C.


1 Answers

You need the junit.jar on your classpath. (I think that is in Ant's lib directory on your locale machine).

You may have a look at the project template https://github.com/mplacona/java-junit-template-project

like image 60
Stefan Birkner Avatar answered Sep 28 '22 15:09

Stefan Birkner