简体   繁体   English

Travis CI使用Ant构建,但未找到JUnit

[英]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. 我正在试图弄清楚如何让Travis CI在Github上使用我的小Java库。

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. 问题似乎是每当构建过程进入编译阶段时,它都不会编译单元测试,因为它似乎无法找到JUnit jar文件。 Of course the Ant script works beautifully on my own computer, but I can't get the classpath right on Travis. 当然,Ant脚本在我自己的计算机上运行得非常漂亮,但我无法在Travis上获得类路径。 How am I supposed to know where (or even if) they installed JUnit? 我怎么知道他们安装JUnit的位置(甚至是否)?

Here's my Ant script: 这是我的Ant脚本:

<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 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 https://travis-ci.org/The-Craw/PrimeFactorizer

You need the junit.jar on your classpath. 您需要在类路径上使用junit.jar。 (I think that is in Ant's lib directory on your locale machine). (我认为这是在您的语言环境机器上的Ant的lib目录中)。

You may have a look at the project template https://github.com/mplacona/java-junit-template-project 您可以查看项目模板https://github.com/mplacona/java-junit-template-project

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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