What does `configuration { compileOnly { extendsFrom ...` do?

In new versions of Spring Boot, the generated build.gradle looks like this:

...
configurations {
 developmentOnly
 runtimeClassPath { extendsFrom developmentOnly }
 compileOnly { extendsFrom annotationProcessor }
}
...
dependencies {
...
 developmentOnly '...'
 annotationProcessor '...'
...
}

Does this mean that the annotation processor libraries should be on the classpath during compilation?

Also what does developmentOnly mean here?

Thanks in advance.

To me, the developmentOnly looks like what Gradle calls a „Custom Configuration“.

Something like that seems like it would be appropriate, for example, for some directory or some jar artifact that has No-Op implementations of stuff that’s intended to only be used in a DEV profile; but not in LIVE.

My understanding is that whatever dependencies are assigned to the annotationProcessor configuration, will definitely be on the compilation classpath (compileOnly in Gradle-speak):

FileCollection annotationProcessorPath

The classpath to use to load annotation processors. This path is also used for annotation processor discovery.

So what I think your snippet is saying is:

  1. developmentOnly: „I want ‘…’ to be on the runtime classpath for my DEV profile“ and…
  2. annotationProcessor: „These ‘…’ artifacts are the annotation processors I intend to use for compiling source code that has annotations in it…“

What did you do to get Spring Boot to generate the stuff you posted, by the way? For me, using the Spring Boot Initializer configured for Gradle, Jersey, Lombok, JDK12 and Spring Boot 2.2.0 M3 (the newest of the new), resulted in this build.gradle:

 plugins {
 	id 'org.springframework.boot' version '2.2.0.M3'
 	id 'java'
 }

 apply plugin: 'io.spring.dependency-management'

 group = 'com.example'
 version = '0.0.1-SNAPSHOT'
 sourceCompatibility = '12'

 configurations {
 	compileOnly {
 		extendsFrom annotationProcessor
 	}
 }

 repositories {
 	mavenCentral()
 	maven { url 'https://repo.spring.io/snapshot' }
 	maven { url 'https://repo.spring.io/milestone' }
 }

 dependencies {
 	implementation 'org.springframework.boot:spring-boot-starter-jersey'
 	compileOnly 'org.projectlombok:lombok'
 	annotationProcessor 'org.projectlombok:lombok'
 	testImplementation('org.springframework.boot:spring-boot-starter-test') {
 		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
 		exclude group: 'junit', module: 'junit'
 	}
 }

 test {
 	useJUnitPlatform()
 }