Hi Eric:
If u want to copy the source file into the class path,
u must set the sourceDirectory and resources and jarResources under the build element.
like this
 
<build>
  <sourceDirectory>#fill here with ur resource root dir#</sourceDirectory>
..........
  <resources>
      <includes>
        <include>**/*.txt</include>
      </includes>
    </resources>
    <jarResources>
      <jarResource>**/*.txt</jarResource>
    </jarResources>    
</build>
If TestFileHolderFile.txt under the root resource dir,
ur code will work!
 
 

        -----Original Message----- 
        From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
        Sent: 2002-11-23 (星期六) 1:11 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: How do I include a text file in my test resource..
        
        

        In my Junit test, I have this line:
         
                File testFile = new
        File(FileHolder.class.getResource("TestFileHolderFile.txt").toString());
         
            }
        
        However, the TestfileHolderFile.txt never gets copied over into either my
        target/test-classes or my target/classes dir..  How can I get it copied
        over?  I used to do this in project.xml:
        
            <unitTest>
              <includes>
                <include>**/*Test.java</include>
                <include>**/Test*.java</include>
               
              </includes>
              <resources>
                <includes>
                  <include>**/*.txt</include>
                </includes>
              </resources>
            </unitTest>
        
        However, as of last nights CVS Head, this no longer works..  I looked at the
        plugin, and I think I am doing everything properly, but no joy...
        
        Thanks,
        Eric

 

IMCaptor

Best Regards

 




<<winmail.dat>>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to