Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-451

ant test fails - resources missing from test classpath

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
    • Environment:

      Description

      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"
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              standish David Standish
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: