classpath元素不是ant junit中的jar警告

时间:2017-12-12 23:18:17

标签: java spring junit ant junit4

我的项目有几种类型的元素,如xml,json,java,jar文件。它们存在于几个子文件夹下的src文件夹中。我已将所有这些包含在我的ant build xml中。 构建文件已成功编译。 编译后,在控制台上显示“测试:”以显示junit。 然后几个警告显示如下:

CLASSPATH元素C:\ buildscripts \ junitAntreal \ src \ unittest \ resources \ log4j.properties不是JAR。

CLASSPATH元素C:\ buildscripts \ junitAntreal \ src \ unittest \ resources \ spring \ appServlet \ controllers.xml不是JAR。

对于包括java文件在内的所有文件,这些警告都是多个。这些警告会一次又一次地重复一个小时,然后显示junit结果。

这些“classpath元素”警告是否重要,如果是,我该如何解决它们?否则我如何跳过这些警告并直接获得我的junit结果?谢谢。

以下是我的构建xml:

<project name = "JunitTest" default = "test" basedir = ".">
    <record name="C:\apache-ant-1.10.1\logfile.txt" action="start" append="false" />
   <property name = "testdir" location = "test" />
   <property name = "srcdir" location = "src" />
   <property name = "full-compile" value = "true" />

   <path id = "classpath.base"/>

   <path id = "classpath.test">
      <pathelement location = "lib/junit-4.12.jar" />
      <pathelement location = "lib/hamcrest-core-1.3.jar" />
      <pathelement location = "${testdir}" />
      <pathelement location = "${srcdir}" />
      <pathelement location="src/WEB-INF/classes"/>
      <fileset dir="src">
        <include name="**/*.java" />
        <include name="**/*.json" />
        <include name="**/*.xml" />
        <include name="**/*.properties" />
        <include name="**/*.jsp" />
        <include name="**/*.css" />
        <include name="**/*.jar" />
        <include name="**/*.js" />
        <include name="**/*.MF" />
        <include name="**/*.xliff" />
        <include name="**/*.sql" />
        <include name="**/*.xsl" />
        </fileset>
        <fileset dir="lib">
        <include name="**/*.jar" />
        </fileset>
      <path refid = "classpath.base" />
   </path>

   <target name = "clean" >
      <delete verbose = "${full-compile}">
         <fileset dir = "${testdir}" includes = "**/*.class" />
      </delete>
   </target>

   <target name = "compile" depends = "clean">
      <javac srcdir = "${srcdir}" destdir = "${testdir}" 
         verbose = "${full-compile}">
         <classpath refid = "classpath.test"/>
      </javac>
   </target>

   <target name = "test" depends = "compile">
      <junit>
         <classpath refid = "classpath.test" />
         <formatter type = "brief" usefile = "false" />
         <test name = "TestMeFile" />
      </junit>
   </target>

    <record name="C:\apache-ant-1.10.1\logfile.txt" action="stop"/>
</project>

0 个答案:

没有答案