gradle-eclipse seems to ignore any user defined logic (i.e. token filtering) in processResources and processTestResources tasks. In my particular case I have a project which filters property files during the execution of these tasks (a-la Maven resource filtering). When this project is executed in an IDE using gradle-eclipse the files copied over verbatim (i.e. with the tokens still in place). This causes all sorts of issues when reading these files as they contain the wrong values (i.e. the original tokens) at runtime.
Fortunately this works perfectly well when using Gradle straight from a shell, it’s just in the IDE (I’m using STS 3.2.0.M1) that tokens do not get replaced.
I attach a link to a sample project which demonstrates the issue:
Running ./gradlew clean build from a shell should yield a successful build in which the project’s single test, in PropertySlurperTest, will pass. However if this same project is imported as a Gradle project in to STS/ Eclipse then running the test in PropertySlurperTest will fail with the following message:
assert expectedPropertyValue == propertySlurper.getProperty("myProperty") | | | | "@expectedTestResult@"| | "@myProperty@" | com.eddgrant.PropertyReader@687bc899 false
From what I can tell the filtering code that I have written in the build.gradle is not being executed when the processResources and processTestResources tasks are invoked in the IDE. I’m guessing however that the tasks are being invoked as the property files both in src/main/resources and src/test/resources are being copied over to the bin directory.
Would be most grateful if anyone knows why this is happening. Particularly for any steer as to whether I’m doing something wrong or whether this is actually a bug in gradle-eclipse?
If you need any further info to understand the problem please don’t hesitate to ask.