> ...so maybe there is a way to avoid this problem in lucene by > removing / re-thinking / tweaking some of dependsOn, mustRunAfter, > or finalizedBy declarations somewhere?
The build does need an overhaul - there are some problems with it that I know about - but it's not as simple as reviewing the dependencies you mentioned - there are also implicit dependencies that are derived from configurations dependencies, source sets, etc. And even if it's a bug in the build - it should be reported as a circular dependency by gradle, not as a cryptic internal error... I do have a plan to work on the build in my spare time - to speed it up and clean up the odd bits - but the spare time seems to be evaporating like ether. Also, historically, running "gradle clean xyz" has been a headache since I can remember because clean is inserted as a normal task into the task graph and then manipulated together with the rest of the dependencies. It's not "everything that depends on clean, followed by everything that depends on xyz", as would be intuitive. It's "everything that depends on clean or xyz, in whatever order". So you may be better off setting up an alias in bash to run gradlew clean && gradlew xyz in sequence... Or - better yet - not run gradlew clean at all - the incremental build should work fine. D.