I have a gradle race condition intermittent behavior on resources

JPA conflicts a bit with src/main/resources in that I had to do something like this

//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 {
tasks.processResources.execute()
//I literally just added this so next time it happens, I can look for this log…
logger.warn(“processed resources=”+sourceSets.main.output.resourcesDir)
}

I am on this gradle version
distributionUrl=http://services.gradle.org/distributions/gradle-2.14.1-all.zip

I am using these parallel gradle properties though (which claim to be in experimental mode)
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true

The speedup is too nice to not have these. I am going to comment out configureondemand and see if I can still reproduce it over the next week though.

My issue however is that there is some sort of race condition though the tasks that I am most interested appear to go in order just fine…

:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:compileJava
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:classes
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:compileTestJava
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:testClasses
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:test

However, the src/main/resources on this project are only copied over 90% of the time to the output directories. The funny thing is the directories are there from src/main/resources. The class files are there as well. Just all the resources are missing but only 1 every 10 runs or so AND my script does a ‘./gradlew clean build’ every time and I just run the .sh script.

It’s very weird and seems to be some sort of race condition.

I will add more info as I find out myself what is going on but I am hoping a little it may be a known issue or something or I am doing something wrong.

More info. commenting out
#org.gradle.configureondemand=true

but I still hit the issue AND I see my log file as well which is before tests run

processed resources=/Library/Workflow/webpieces/webserver/webpiecesServerBuilder/templateProject/WEBPIECESxAPPNAME/output/classes/main
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:classes
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:compileTestJava
:embeddablehttpproxy:syncJars
:embeddablehttpproxy:checkstyleMain
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:testClasses
:webserver:webpiecesServerBuilder:templateProject:WEBPIECESxAPPNAME:test

but alas, no resource files are there this run. What other logs can I add to debug this situation?

I really want org.gradle.parallel=true as the speedup is 2 minutes 20 seconds down to 52 seconds, but it seems the parallel keeps hitting the race condition(when I comment it out, I never see it fail).

Is there something behind this method
tasks.processResources.execute()

that kicks off a background thing that I need to somehow block on before tests are run?