当我尝试构建项目时,詹金斯给我“意外元素“ {}路径” {antlib:org.apache.tools.ant}路径”

时间:2019-02-18 18:19:03

标签: java eclipse jenkins github build.xml

每当对我的GitHub存储库进行一次推送时,我都需要使用Jenkins构建我的项目,但是,当进行一次推送时,Jenkins会被触发,但无法成功完成构建;给我以下内容:“ 构建失败 C:\ Program Files(x86)\ Jenkins \ workspace \ ShoppingCart \ LibraryShoppingCart \ build.xml:1:意外元素“ {} path” {antlib:org。 apache.tools.ant}路径“

这是我的build.xml:

<path id="NecessaryLibraries">
    <pathelement location="./UsedLibraries/junit.jar"/>
    <!--matcher-->
    <pathelement location="./UsedLibraries/org.hamcrest.core_1.3.0.v20180420-1519.jar"/>
    <pathelement location="./UsedLibraries/org.junit.jupiter.api_5.1.0.v20180327-1502.jar"/>

    <!--<pathelement location="./UsedLibraries/jacocoant.jar"/>-->
</path>


<target name="compile-testcases" depends="compile">
    <mkdir dir="${result.testclasses.dir}"/>
    <javac srcdir="${src.test.dir}"  destdir="${result.testclasses.dir}" debug="true" includeantruntime="false">
        <classpath>

            <path refid="NecessaryLibraries"/>
            <pathelement location="${result.javaclasses.dir}"/>
        </classpath>
    </javac>        
</target>

<target name="test" depends="compile-testcases">
    <!--fork : each test will run in its own JVM (to seperate test cases)-->
    <junit printsummary="true" haltonfailure="true" fork="true">
        <classpath>
            <path refid="NecessaryLibraries"></path>
            <pathelement location="${result.javaclasses.dir}"/>
            <pathelement location="${result.testclasses.dir}"/>
        </classpath>
        <formatter type="brief" usefile="false"/>
        <batchtest >
            <fileset dir="${result.testclasses.dir}" >
                 <include name="**/*Test.class"/>
            </fileset>
        </batchtest>

    </junit>
</target>

所有Jar文件和使用过的库都被复制并粘贴到“ UsedLibraries” src文件夹中。

0 个答案:

没有答案