Hi Sean,

Can you post a snippet of the Java code you're using to access the
files? Also, what value is this set to for your tests?

new File('.').getAbsolutePath()

Cheers,
Merlyn
 
On Mon, 2011-05-23 at 21:11 +1000, Sean Van Buggenum wrote:
> Hi all, 
> 
> 
> for what I believe may be my final problem for some time, 
> I would like a better understanding of what is causing the test
> resources of my project not to be picked up at runtime (of the junit
> tests).
> 
> 
> For a better understanding of my setup, let me explain;
> 
> 
> My projects (which i've been migrating from junit to gradle) have a
> structure like this:
> 
> 
> {projectDir}
> {projectDir}/src
> {projectDir}/test
> {projectDir}/build.gradle
> 
> 
> and the output gets placed as usual at:
> 
> 
> {projectDir}/build/classes/main
> {projectDir}/build/classes/test
> 
> 
> I have resources, such as XML files in with my test source files, for
> example, I have an XML file in the test directory, at some level. 
> When I check to see if this XML file is turning up in the build
> output, at ./build/classes/test/etcetc
> 
> 
> it is. No problem there. 
> 
> 
> However, when my junit test runs, it is not able to find the xml file
> which it tries to read on the classpath. 
> 
> 
> So, my question is regarding classpath and the junit test run during
> java build. 
> 
> 
> Any idea why it is not working? 
> 
> 
> In case it matters, i've modified the working dir for the test run,
> via
> 
> 
> test{
> workingDir = new File("${junitWorkingDir}")
> }
> 
> 
> I wouldn't think this matters, if my file is on the classpath
> correctly.
> 
> 
> My build file looks like this:
> ----------------------------------
> 
> 
> apply plugin: 'java'
> 
> 
> 
> 
> sourceSets {
>     main {
>         java {
>             srcDir 'src'
>         }
>         resources {
>             srcDir 'src'
>         }
>     }
> 
> 
>     test {
>         java {
>             srcDir 'test'
>         }
>         resources {
>             srcDir 'test'
>         }
>    
>     }
> }
> 
> 
> 
> 
> test{
> workingDir = new File("${junitWorkingDir}")
> }
> 
> 
> jar{
>    manifest.from("src/META-INF/MANIFEST.MF")
> }
> 
> 
> dependencies { 
> testCompile files("${buildLibs}/junit.jar")
> testCompile files("${buildLibs}/app.jar")
> testCompile project(':general/ModulesTestCaseBase')
> compile files("${buildHome}/app.jar")
> }
> 
> 
> 
> 
> 
> 
> I guess I need to add something to test.runtimeClasspath  but, I don't
> know why... 
> 
> 
> 
> 
> Again, thanks in advance. 
> Should I come across the answer by myself, i'll post it for others.
> 
> 
> sean
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to