Skip to content

kotlinPluginOptions not working #19

@YounesRahimi

Description

@YounesRahimi

I want to use plugins allopen and noarg to define some annotations to open classes. But plugin options don't work and at runtime spring will throw error that class XXX may not be final.

sbt.build configs:

    val annotation = "annotation"
    kotlinPlugin("allopen")
    kotlincPluginOptions in Compile ++= {
      val plugin = KotlinPluginOptions("org.jetbrains.kotlin.plugin.allopen")
      plugin.option(annotation, "javax.inject.Inject") ::
        plugin.option(annotation, "javax.inject.Singleton") ::
        plugin.option(annotation, "javax.persistence.Entity") ::
        plugin.option(annotation, "org.springframework.context.annotation.Configuration") ::
        plugin.option(annotation, "org.springframework.stereotype.Component") ::
        plugin.option(annotation, "org.springframework.scheduling.annotation.Async") ::
        plugin.option(annotation, "org.springframework.transaction.annotation.Transactional") ::
        plugin.option(annotation, "org.springframework.cache.annotation.Cacheable") ::
        Nil
    }

    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-noarg
    kotlinPlugin("noarg")
    val noArgPlugin = KotlinPluginOptions("org.jetbrains.kotlin.plugin.noarg")
    kotlincPluginOptions in Compile += noArgPlugin.option(annotation, "javax.persistence.Entity")
    kotlincPluginOptions in Compile += noArgPlugin.option(annotation, "javax.persistence.Embeddable")

Spring runtime error:

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'SpringDataJpaModule.SpringDataJpaConfiguration' may not be final. Remove the final modifier to continue.
Offending resource: SpringDataJpaModule$SpringDataJpaConfiguration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions