What about if I want to put my TestFileHolderFile.txt under my test code
hierarchy?  I only need the text file for testing, so I don't want to
clutter up my production code?
 
This is what I am currently working with, to no avail.
 
 
<build>
    <nagEmailAddress></nagEmailAddress>
    <sourceDirectory>src</sourceDirectory>
    <unitTestSourceDirectory>tests/test</unitTestSourceDirectory>
    <aspectSourceDirectory></aspectSourceDirectory>
 
    <sourceModifications>
      <sourceModification>
        <excludes>
            <exclude>com/**/*.*</exclude>
        </excludes>
      </sourceModification>
    </sourceModifications>
 
    
    <unitTest>
      <includes>
        <include>**/*Test.java</include>
        <include>**/Test*.java</include>
        
      </includes>
      <resources>
        <includes>
          <include>**/*.txt</include>
        </includes>
      </resources>
    </unitTest>
    
    <resources>
            <includes>
              <include>**/*.txt</include>
            </includes>
      </resources>
    <jars></jars>
  </build>
 
Thanks,
Eric Pugh

-----Original Message-----
From: WANGHB [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 23, 2002 8:32 AM
To: Turbine Maven Users List
Subject: RE: How do I include a text file in my test resource..


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

 




Reply via email to