Groovy script in resources directory


(Basil Peace) #1

I have a config.groovy file in src/main/resources directory. It is actually a Groovy script, but the main code requires it as text, not compiled class.
However, compileGroovy task compiles it, and resulting jar has no resource inside, and config.class instead.
Is it intended behavior, or something wrong? And is there some simple workaround except changing filename extension?

I use Gradle 4.3.


(Sterling Greene) #2

This isn’t the default behavior, so you may have some configuration that’s causing this (e.g., adding src/main/resources as a source directory).


(Basil Peace) #3

Thanks!
Found out that I had src/main in groovy.srcDirs instead of src/main/groovy.