我试图弄清楚如何让 Travis CI 与我在 Github 上的小型 Java 库一起工作。
问题似乎是,每当构建过程进入编译阶段时,它就不会编译单元测试,因为它似乎找不到 JUnit jar 文件。当然,Ant 脚本在我自己的计算机上运行良好,但我无法在 Travis 上获得正确的类路径。我怎么知道他们在哪里(甚至是否)安装了 JUnit?
这是我的蚂蚁脚本:
<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>
这是项目链接,请注意漂亮的“构建失败”图标。耶。
https://github.com/The-Craw/PrimeFactorizer
最后是构建输出的链接。您也可以通过单击构建图标来获取此信息。
https://travis-ci.org/The-Craw/PrimeFactorizer