Filtering *only* test resources


I’m trying to filter only test resources in each subproject. I have followed this example:

replacing the “all” with * as necessary in the latest gradle versions and slighly adapted to this:

afterEvaluate {
    def processResourcesTasks = sourceSets*.processResourcesTaskName.collect { tasks[it] }
      processResourcesTasks.each {
            filter(ReplaceTokens, tokens: testProperties)

However, this filters all resources in java and also in test. How would I go about restricting this to only filter resources in my src/main/resources folder?

Thank you! :slight_smile:

Since you are talking about test resources, I assume you want to filter ‘src/test/resources’. That’s as simple as:

processTestResources {
  filter(ReplaceTokens, tokens: testProperties)

Excellent, thank you.

Just one last thing I suppose, if I define the processTestResources, does it replace (or append) other processTestResource(s) in subprojects?


To apply this configuration to all subprojects, wrap it with ‘subprojects { … }’. Or ‘allprojects’, if the current project is to be included as well.

ta. :slight_smile: