2011-07-04 21 views
2

私はPragmatic Project Automationの例に従っています。私はWindows 7で動作しており、ローカルのSubversionリポジトリからプロジェクトを引き出しています。 antをプロジェクトのベースディレクトリに実行すると、次のエラーが発生します[junit] couldn't delete .svn。ここでは、コマンドの完全な出力です:JUnit Antビルドスクリプトで.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ディレクトリを削除しようとしていますか?どちらを削除しようとしていますか?なぜそれができないのですか?

答えて

3

com.pragprog.dms.SearchTestのテストケースtestTitleSearchが失敗しています。 testContentSearchと同じことが起こります。彼らはおそらく、始める前に家を清掃しようとしています。私はあなたが誤ってテストケースのスクラッチディレクトリをローカルでクローンするときにバージョン管理下に置いていると思います。

+0

私は '-N [--non-recursive]'をたくさん使っていましたが、 '--depth'が優先されるようになりました。 – trashgod

+0

ああ、プロジェクトのベースディレクトリのインデックス/フォルダをスクラッチフォルダとして使用していたことが判明しました。ビルドスクリプトはすぐに実行されます。プロセスエクスプローラを使用して問題のあるフォルダを特定しました。それは物事を行う非常に効率的な方法ではないようです。これをトラブルシューティングするより良い方法はありますか?たとえば、JUnitにフルパスを吐き出すことは可能ですか? –

+0

'JUnit'についてはわかりませんが、' ant'の古いバージョンでは '' enableTestListenerEvents'(http://ant.apache.org/manual/Tasks/junit.html)が必要な場合があります。 – trashgod

関連する問題