Neil Chaudhuri wrote:
> 
> I would like to do something akin to the following:
> 
> test {
>    classpath = runtimeClasspath +
> file("${sourceSets.main.resourcesDir}${File.separator}orm.xml")
> }
> 

Resources automatically end up on the test class path. You don't have to do
anything to make this happen.


Neil Chaudhuri wrote:
> 
> In other words, I have been having trouble doing the following two things:
> 
> * Referencing the resources directory without using the hardcoded
> "src/main/java." Although sourceSets.main.classesDir works,
> sourceSets.main.resourcesDir doesn't.
> 

It's "sourceSets.main.resources.srcDirs". There can be multiple resource
directories.
"sourceSets.main.classesDir" is something different, it's the output
directory for compiled classes.


Neil Chaudhuri wrote:
> 
> * Adding a single file to the runtime classpath with a +
> 

FileCollection.plus() expects another FileCollection, so you have to do:

runtimeClasspath + files(...) // "files", not "file"

Hopefully, the Gradle DSL guide and Javadoc help to clarify such questions.

--
Peter Niederwieser 
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradleware
http://www.gradleware.com
Creator, Spock Framework
http://spockframework.org


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Referencing-Resources-Directory-to-Add-to-Test-Classpath-tp3414593p3415087.html
Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Reply via email to