I’m having an issue as of late when compiling a java library with Gradle 4.0.1 (this issue was happening with 3.5 as well) using the ‘java-library’ plugin. Here is a snipped of my build script:
I can reproduce the error on those versions of Gradle by typing an invalid / invisible character, which seems like the most likely situation that could occur accidentally. There’s not one in your post, but the forums could have stripped it out. Maybe try deleting and re-typing the apply plugin: 'java-library' line to see if there’s any difference.
I can reproduce the error other ways as well, but not in a way one could realistically accomplish without the specific intent to cause this error, so I would think if would then be something unique about your environment that isn’t mentioned. Just what you’ve provided seems to work as expected.
It looks like IntelliJ isn’t using the version of gradle I tell it to so I should post this issue on their form (the build script works via terminal though). Thank you for your help!