David Standish created IO-451:
---------------------------------

             Summary: ant test fails - resources missing from test classpath
                 Key: IO-451
                 URL: https://issues.apache.org/jira/browse/IO-451
             Project: Commons IO
          Issue Type: Bug
    Affects Versions: 2.5
         Environment: Apache Ant(TM) version 1.9.3 compiled on April 8 2014
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK Server VM (build 24.51-b03, mixed mode)
Linux weeble 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:43:42 UTC 2014 i686 
i686 i686 GNU/Linux

            Reporter: David Standish


ant test does not copy test resources to target/ and does not include test 
resources in test class path.
maven test is ok.

Example failure:
----------------------------------------------
someguy@weeble:~/prog/java/commons-io/commons-io$ ant clean
Buildfile: /home/someguy/prog/java/commons-io/commons-io/build.xml
 .
 .
 .
BUILD SUCCESSFUL
Total time: 0 seconds

someguy@weeble:~/prog/java/commons-io/commons-io$ ant test
Buildfile: /home/someguy/prog/java/commons-io/commons-io/build.xml
 .
 .
 .
    [junit] Running org.apache.commons.io.FileUtilsListFilesTestCase
    [junit] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 
0.064 sec
    [junit] Running org.apache.commons.io.FileUtilsTestCase
    [junit] Tests run: 20, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 
0.087 sec

BUILD FAILED
/home/someguy/prog/java/commons-io/commons-io/build.xml:192: Test 
org.apache.commons.io.FileUtilsTestCase failed

Total time: 32 seconds

----------------------------------------------


candidate patch to resolve issue
------------------------------------------------
someguy@weeble:~/prog/java/commons-io/commons-io$ svn diff build.xml 
Index: build.xml
===================================================================
--- build.xml   (revision 1609743)
+++ build.xml   (working copy)
@@ -63,6 +63,9 @@
   <!-- The base directory for unit test sources -->
   <property name="test.home"               value="src/test/java"/>
 
+  <!-- The base directory for unit test resources -->
+  <property name="test.resources.home"               
value="src/test/resources"/>
+
   <!-- Download lib dir -->
   <property name="download.lib.dir"        value="lib"/>
 
@@ -115,6 +118,7 @@
   <path id="test.classpath">
     <pathelement location="${build.home}/classes"/>
     <pathelement location="${build.home}/test-classes"/>
+    <pathelement location="${build.home}/test-resources"/>
     <pathelement location="${junit.jar}"/>
     <path refid="downloaded.lib.classpath"/>
   </path>
@@ -177,6 +181,9 @@
              includeantruntime="false">
           <classpath refid="test.classpath"/>
       </javac>
+      <copy todir="${build.home}/test-resources">
+        <fileset dir="${test.resources.home}"/>
+      </copy>
     </target>
 
   <target name="test"  depends="compile.tests"





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to