gpt4 book ai didi

java - Ant 构建脚本中的 JUnit 尝试删除 .svn 目录但失败

转载 作者:行者123 更新时间:2023-12-04 06:21:01 25 4
gpt4 key购买 nike

我正在关注 Pragmatic Project Automation 的一个例子。我在 Windows 7 上运行并从本地 Subversion 存储库中提取项目。当我跑 ant在项目的基目录中,我收到以下错误 [junit] couldn't delete .svn .这是命令的完整输出:

Buildfile: S:\CruiseControl\builds\dms\checkout\dms\build.xml

prepare:
[mkdir] Created dir: S:\CruiseControl\builds\dms\checkout\dms\build\prod
[mkdir] Created dir: S:\CruiseControl\builds\dms\checkout\dms\build\test

compile:
[javac] Compiling 5 source files to S:\CruiseControl\builds\dms\checkout\dms\build\prod

compile-tests:
[javac] Compiling 7 source files to S:\CruiseControl\builds\dms\checkout\dms\build\test

test:
[junit] Testsuite: com.pragprog.dms.DocumentTest
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.065 sec
[junit]
[junit] Testsuite: com.pragprog.dms.SearchTest
[junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 0.015 sec
[junit]
[junit] Testcase: testTitleSearch(com.pragprog.dms.SearchTest): Caused an ERROR
[junit] couldn't delete .svn
[junit] java.io.IOException: couldn't delete .svn
[junit] at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:166)
[junit] at org.apache.lucene.store.FSDirectory.<init>(FSDirectory.java:151)
[junit] at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:132)
[junit] at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:160)
[junit] at com.pragprog.dms.Indexer.index(Unknown Source)
[junit] at com.pragprog.dms.SearchTest.setUp(Unknown Source)
[junit]
[junit]
[junit] Testcase: testContentSearch(com.pragprog.dms.SearchTest): Caused an ERROR
[junit] couldn't delete .svn
[junit] java.io.IOException: couldn't delete .svn
[junit] at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:166)
[junit] at org.apache.lucene.store.FSDirectory.<init>(FSDirectory.java:151)
[junit] at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:132)
[junit] at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:160)
[junit] at com.pragprog.dms.Indexer.index(Unknown Source)
[junit] at com.pragprog.dms.SearchTest.setUp(Unknown Source)
[junit]
[junit]

BUILD FAILED
S:\CruiseControl\builds\dms\checkout\dms\build.xml:33: Test com.pragprog.dms.SearchTest failed

Total time: 0 seconds

和 build.xml 文件:
<project name="dms" default="compile" basedir=".">
<property name="build.dir" location="build" />
<property name="build.prod.dir" location="${build.dir}/prod" />
<property name="build.test.dir" location="${build.dir}/test" />
<property name="doc.dir" location="doc" />
<property name="index.dir" location="index" />
<property name="src.dir" location="src" />
<property name="test.dir" location="test" />
<property name="vendor.lib.dir" location="vendor/lib" />
<path id="project.classpath">
<pathelement location="${build.prod.dir}" />
<pathelement location="${build.test.dir}" />
<fileset dir="${vendor.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="prepare">
<mkdir dir="${build.prod.dir}" />
<mkdir dir="${build.test.dir}" />
</target>
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}" destdir="${build.prod.dir}" includeantruntime="false">
<classpath refid="project.classpath" />
</javac>
</target>
<target name="compile-tests" depends="compile">
<javac srcdir="${test.dir}" destdir="${build.test.dir}" includeantruntime="false">
<classpath refid="project.classpath" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="test" depends="compile-tests">
<junit haltonfailure="true">
<classpath refid="project.classpath" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${build.test.dir}" includes="**/*Test.class" />
</batchtest>
<sysproperty key="doc.dir" value="${doc.dir}" />
<sysproperty key="index.dir" value="${index.dir}" />
</junit>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>

为什么 JUnit 试图删除 .svn 目录?它甚至试图删除哪一个?为什么它没有这样做?

最佳答案

看起来像测试用例 testTitleSearchcom.pragprog.dms.SearchTest正在失败。同样的情况也发生在 testContentSearch .他们可能在开始之前试图打扫房子。我猜你在本地克隆它时无意中将测试用例的临时目录置于版本控制之下。

关于java - Ant 构建脚本中的 JUnit 尝试删除 .svn 目录但失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6566519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com