Skip to content

If both ksp and kapt plugins are available, both also create bean definitions  #801

@braeluca

Description

@braeluca

Expected Behavior

If both ksp and kapt plugins are available, only one should be used.

Actual Behaviour

If both ksp and kapt plugins are available, both also create bean definitions, which is inefficient. It also leads to and exception when building the jar:

Execution failed for task ':runnerJar'.
Entry org/example/$ExampleController$Definition$Reference.class is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/8.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

However this can be resolved by specifying a duplicate strategy, but it is still inefficient. Sometimes kapt is also needed for other annotation processors.

Steps To Reproduce

  1. Create application with micronaut launch: mn create-app --build=gradle_kotlin --jdk=17 --lang=kotlin --test=junit com.example.demo
  2. Create any Bean or Controller
  3. Add kapt plugin to build.gradle.kts
  4. Run the assemble task

Environment Information

  • Operating System: macos 13.4.1 arm
  • JDK 17.0.6

Example Application

https://github.com/braeluca/micronaut-kapt-ksp-demo

Version

4.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang: kotlinIssues or features specific to Kotlin

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions