How do I add resources to sourceSet with gradle?

Viewed 76271

Currently I have the following build.gradle file:

apply plugin: 'java'

repositories {
    mavenCentral()
}

sourceSets {
    main {
        java {
            srcDir 'src/model'
        }
        resources {
            srcDir 'images/model' 
        }
    }

    test {
        java {
            srcDir 'tests/model'
        }
        resources {
            srcDir 'images/model' // <=== NOT WORKING
        }
    }
}

dependencies {
    compile files('libs/mnist-tools.jar', 'libs/gson-2.2.4.jar')
    runtime fileTree(dir: 'libs', include: '*.jar')

    testCompile group: 'junit', name: 'junit', version: '4.+'
}

My repository if here: https://github.com/quinnliu/WalnutiQ

and 4 out of my 49 tests are failing because the tests in folder "tests/model" need a file within the folder "images/model". How do I add the resources correctly? Thanks!

2 Answers
Related