I have a Gradle plugin, that gets built as Jar and uploaded to a repository. Now I would like to move a configuration file into the src/main/resources folder of one plugin. But I can't get hold of the resource during project evaluation, I suspect it's because I am referencing it only in the buildscript { } block.
The project's buildscript essentially looks like this
buildscript {
repositories { mavenRepo url: "http://..." }
dependencies { classpath "gradle:loadtest-plugin:0.1.0" }
}
apply plugin: "loadtest-plugin"
Inside the loadtest-plugin.jar there is a src/main/resources/config.txt which I would like to access from inside the plugin, like this:
def config = ClassLoader.getResourceAsStream("config.txt").text
But I only get NullPointerExceptions. Any Ideas?