Failed to apply plugin [id 'java']


I encountered a weird issue while upgrading our multi-module Gradle project from ‘1.12’ to ‘2.2.1’. Once updated I get:

$ ./gradlew clean
  FAILURE: Build failed with an exception.
  * Where:
Build file '/my-project/spring-integration/build.gradle' line: 54
  * What went wrong:
A problem occurred evaluating root project 'spring-integration'.
> Failed to apply plugin [id 'java']
   > model 'tasks' is finalized

Gradle build file:

subprojects { subproject ->
   apply plugin: 'java'

It works, once I move the ‘apply’ to here:

allprojects {
 group = 'org.springframework.integration'
  apply plugin: "java"

I tested various Gradle versions. It looks like our build is still working with ‘2.0’ but from ‘2.1’ onwards it fails. What is going on here? While I can move the ‘apply java’ to ‘allprojects’ it feels a bit incorrect. I rather like to have it as it is now. What do I miss?


This looks to have been addressed in Gradle 2.3 which should be released early next week.

Confirmed - ‘2.3-rc-3’ is addressing the issue. This is timely :slight_smile: Thanks!