Very odd compile issue with intellij section

I have the following code and am running gradle 4.8.1 (just upgraded from 4.1)

//Intellij Idea has a weird quirk we need to avoid
if (System.getProperty('')) {
    //Intellij Idea has a weird quirk we need to avoid AND gradle needs the *.html files in the classpath
    //eclipse is just fine and needs nothing
    // to add src/main/java/**/*.html files for the IntelliJ resource builder
    sourceSets {
        main {
            resources {
                srcDirs += ["src/main/java"]
                excludes = ["logback.xml"]

    // to have classes and resources in the same output directory
    idea {
        module {
            outputDir file("out/production/classes")

BUT it fails to compile SOOOO, I ironically comment out the sourceSets section (which should not be running) and the compile now passes). This is a BIG WTF…heh. Any ideas on why the property read seems to think it’s running in intellij?


oh, I should mention, I need the sourceSets in gradle(not just intellij). tests start failing as resources become missing!!!

Any ideas why my compile fails in 4.8.1? I am trying to upgrade but this one little piece is not going so well.

The project is

and I typically run the command

/gradlew -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=false build -PexcludeSelenium=true -PexcludeH2Spec=true

which is passing on master but failing when I modify gradle/wrapper/ to point to 4.8.1


hmmm, actually, I think this may be the code that broke…

    //ok, this is the deal here.  JPA/hibernate made the decision to look for a persistence.xml file
    //and scan for classes with @Entity in the directory OR jar with that xml file only
    //maven(and I hate this) a long time ago separated src/main/java and src/main/resources but
    //this screws tools in many situations like this one so this puts it back so the output is at
    //least put to the same location
    sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir
    compileJava.doLast {
       logger.warn("processed resources="+sourceSets.main.output.resourcesDir)

In version 4.1, I see my html files copied out of source directories




BUT in 4.8, they are not copied over anymore? which makes my tests fail. Of course, I have to comment out sourceSets just to make it compile for some reason which I don’t understand.