Where do i put resources?


(rtayek) #1

hi, i use eclipse and am new to gradle (i just bought this book).

my project structure is src/ tst/ with a few properties files in src/ (at the root). i read this using get resource bundle and also as a properties file.

i found this question: http://forums.gradle.org/gradle/topics/resources_from_src_main_resources_not_included_for_test

my tests can’t find the resources (since they don’t get copied) and they don’t end up in the jar.

where can i put them so i can still read them using eclipse?

what do i need to do to my gradle file? (please see below)

thanks

apply plugin: ‘java’ apply plugin: ‘eclipse’ apply plugin: ‘maven’ repositories { mavenCentral() } sourceSets.main.java.srcDirs = [“src”] sourceSets.test.java.srcDirs = [“tst”] dependencies {

compile fileTree(dir: ‘lib’, includes: [’*.jar’])

testCompile group: ‘junit’,name:‘junit’,version: ‘4.8+’ }


(Peter Niederwieser) #2
sourceSets.main.resources.srcDirs = ["src"]

See Working with source sets in the Gradle user guide.


(rtayek) #3

ourceSets.main.resources.srcDirs = [“src”]

wondeful!

thanks