Skip to content

Annotation processors are added to compileOnly and annotationProcessor but we configure compileOnly to extend annotationProcessor #1379

Open
@wilkinsona

Description

@wilkinsona

Example build.gradle script:

plugins {
  id 'java'
  id 'org.springframework.boot' version '3.0.3-SNAPSHOT'
  id 'io.spring.dependency-management' version '1.1.0'
}

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

configurations {
  compileOnly {
    extendsFrom annotationProcessor
  }
}

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

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter'
  compileOnly 'org.projectlombok:lombok'
  annotationProcessor 'org.projectlombok:lombok'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
  useJUnitPlatform()
}

Configuring compileOnly to extend from annotationProcessor means that org.projectlombok:lombok doesn't need to be declared in both compileOnly and annotationProcessor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions