Alter the classpath during tests

This is probably an easy thing to do, although googling for the solution for almost a whole day makes me a bit suspisiuos…

What I need to do is to replace some reseources from the runtime classpath when running my tests. There is both a settings.groovy and a logback.groovy that I want to be replaced by equivalents made for tests.

How do I get the test task not to include the src/main/resources? (but let the src/test/resources remain)?

This should do the job:

sourceSets.test.runtimeClasspath -= files(sourceSets.main.output.resourcesDir)

Wow thanks!!