I tried your suggestion but it hasn't made any difference.  

 

Did you mean for me to type 'testCompile subprojects' or should I be
explicitly naming a sub-project?

 

Thanks

 

________________________________

From: Adam Murdoch-3 [via Gradle]
[mailto:[email protected]] 
Sent: 30 July 2010 01:58
To: Richard Murray
Subject: Re: testCompile classpath for multiproject build

 

  On 27/07/10 1:07 AM, richardm wrote: 


> I have a multiproject build with the following layout. 
> 
> TopLevelProject 
>     /SubProjA/src 
>     /SubProjB/src 
>     /SubProjC/src 
>     /tests            -- all unit tests for SubProjects 
>     /lib                -- JAR files required for compile of SubProjects 
>     build.gradle 
>     settings.gradle 
> 
> How can I specify the classpath for tests to include the compiled classes 
> (or generated JARS) from the subprojects? 
> 
> The tests directory contains the src code for junit tests for all of the 
> subprojects. 
> 
> I have the subprojects compiling OK, but compiling the unit test classes in

> TopLevelProject/tests keeps failing as the compiled classes in the 
> subprojects aren't on the classpath. 
> 
> My build.gradle file is shown below.  Thanks. 
> 
> apply plugin: 'java' 
> 
> dependsOnChildren() 


I'd get rid of dependsOnChildren(), and do something like: 

dependencies { 
     testCompile subprojects 
} 

This will include the main classes of each subproject in the compile 
classpath for the tests. 


> allprojects { 
> sourceCompatibility = 1.5 
> targetCompatibility = 1.5 
> } 
> 
> sourceSets { 
>    test { 
>          java { 
>              srcDir 'tests' 
>          } 
>          resources { 
>              srcDir 'tests' 
>          } 
> } 
> } 
> 
> subprojects  { 
> apply plugin: 'java' 
> sourceSets.main.java.srcDir 'src' 
> dependencies{ 
> //TODO remove hard-coded references to D:/workspace 
> compile fileTree(dir: 'D:/workspace/uwm/lib', include: '*.jar'), 
> fileTree(dir: 'D:/workspace/uwm/build/lib', include: '*.jar') 
> } 
> } 
> 
> project(':SubProjB') { 
>    dependencies.compile project(':SubProjA') 
> } 
> 
> project(':SubProjC') { 
>    dependencies.compile project(':SubProjB') 
> } 
> 
> 



-- 
Adam Murdoch 
Gradle Developer 
http://www.gradle.org <http://www.gradle.org?by-user=t> 
CTO, Gradle Inc. - Gradle Training, Support, Consulting 
http://www.gradle.biz <http://www.gradle.biz?by-user=t> 


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

    http://xircles.codehaus.org/manage_email





________________________________

View message @
http://gradle.1045684.n5.nabble.com/testCompile-classpath-for-multiproject-bu
ild-tp2228146p2256859.html 
To unsubscribe from testCompile classpath for multiproject build, click here
< (link removed) 
GFyZC5NdXJyYXlAb3JjaGFyZC1zeXN0ZW1zLmNvLnVrfDIyMjgxNDZ8MzU2MTczMDEz> . 

 


-- 
View this message in context: 
http://gradle.1045684.n5.nabble.com/testCompile-classpath-for-multiproject-build-tp2228146p2259386.html
Sent from the gradle-user mailing list archive at Nabble.com.

Reply via email to