代码之家  ›  专栏  ›  技术社区  ›  TheJediCowboy

不能让Junit在ANT构建中使用Spring

  •  2
  • TheJediCowboy  · 技术社区  · 14 年前

    我正试图让springmvc和Junit相互协作,我在配置生成.xml文件。我是一个相当新的使用蚂蚁和不真正理解所有的教程。我把junit.jar文件文件,但我仍然从控制台收到以下消息。

    test:
    
    BUILD FAILED
    C:\Java\mmz\WEB-INF\build.xml:63: The <classpath> for <junit> must include junit.jar if not in Ant's own classpath
    
    Total time: 223 milliseconds
    

    编辑

    下面是一个只想运行一个测试的示例

    我不知道我需要做什么,我试着做了如下的事情,但我不太明白它在做什么,所以我不知道如何做出改变

     <path id="classpath.test">
        <pathelement location="" />
        <pathelement location="${test.dir}" />
      </path>
    <target name="test">
        <junit>
          <classpath refid="classpath.test" />
          <formatter type="brief" usefile="false" />
          <test name="TesterTest" />
        </junit>
    </target>
    

    我真不知道下一步该怎么办。谢谢

    1 回复  |  直到 14 年前
        1
  •  2
  •   uriDium    14 年前

    如果你复制粘贴你的生成.xml文件,那么可能在某个地方有一个classpath元素。可能在文件的最上面。在该元素中,它们可能列出了一些路径和/或文件。您需要将junitjar添加到此部分。