piotrek
piotrek

Reputation: 14550

How to make gradle javadoc plugin honor lombok processing?

I have a standard gradle java project and i use lombok. one of my class has

@NoArgsConstructor(access = AccessLevel.PACKAGE) 

but when i run ./gradlew javadoc the reported visibility is public. is there any smart/fast way or do i have to run delombok and run javadoc on delombokked sources? and how to do it with gradle?

gradle 3.3, lombok 1.16.14

Upvotes: 4

Views: 2796

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75635

do i have to run delombok and run javadoc on delombokked sources?

I saw already people complaining about incomplete JavaDocs when using lombokked projects, so if delombokking solves your problem and there's no obstacle doing it that way, then it might be your solution.

and how to do it with gradle

Here're gradle tasks for the delombok and javadoc job:

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

javadoc {
    dependsOn delombok
    source = delombok.outputDir
    failOnError = false
}

Sources:

Upvotes: 5

Related Questions