Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions of gradle-lombok tasks fail with Gradle 6.4 #76

Closed
chadlwilson opened this issue May 7, 2020 · 0 comments · Fixed by #77
Closed

Extensions of gradle-lombok tasks fail with Gradle 6.4 #76

chadlwilson opened this issue May 7, 2020 · 0 comments · Fixed by #77

Comments

@chadlwilson
Copy link
Contributor

chadlwilson commented May 7, 2020

A canonical extension task like the below fails on Gradle 6.4 with

The value for task ':myDelombok' property 'mainClass' is final and cannot be changed any further

Example

task myDelombok(type: io.franzbecker.gradle.lombok.task.DelombokTask, dependsOn: compileJava) {
    ext.outputDir = file("$buildDir/delombok")
    outputs.dir(outputDir)
    sourceSets.main.java.srcDirs.each {
        inputs.dir(it)
        args(it, "-d", outputDir)
    }
}

According to gradle/gradle#12841 this is because main is now backed by a property, and you can only set it during configuration; so setting it during exec doesn't work any longer.

Workaround - directly use a JavaExec task

task myDelombok(type: JavaExec, dependsOn: compileJava) {
    main = project.extensions.findByType(io.franzbecker.gradle.lombok.LombokPluginExtension).main
    args 'delombok'
    classpath = project.configurations.getByName('compileClasspath')

    ext.outputDir = file("$buildDir/delombok")
    outputs.dir(outputDir)
    sourceSets.main.java.srcDirs.each {
        inputs.dir(it)
        args(it, "-d", outputDir)
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant