In our Java Spring project we use Lombok extensively and use the lombok gradle plugin.
We also do code generation with the Open API plugin.
When I upgrade from Lombok 8.6 to 8.10 (with no other changes) I now get this error from Gradle.
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':entity-client:generateEffectiveLombokConfig' (type 'LombokConfig').
- Gradle detected a problem with the following location: '/Users/fkelly/dev/platform2-entity/entity-client/build/openapi-source/src/main/java'.
Reason: Task ':entity-client:generateEffectiveLombokConfig' uses this output of task ':entity-client:generateClientCode' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':entity-client:generateClientCode' as an input of ':entity-client:generateEffectiveLombokConfig'.
2. Declare an explicit dependency on ':entity-client:generateClientCode' from ':entity-client:generateEffectiveLombokConfig' using Task#dependsOn.
3. Declare an explicit dependency on ':entity-client:generateClientCode' from ':entity-client:generateEffectiveLombokConfig' using Task#mustRunAfter.
Any thoughts / suggestions?
4
I found a work-around after some Gradle googling but I’m not happy with it.
// Due to Gradle dependency error when upgrading from Lombok 8.6 to 8.10
// Based on solution https://discuss.gradle.org/t/implicit-dependency-among-tasks-but-the-tasks-do-not-exist/46127
tasks.configureEach {
if (name == "generateEffectiveLombokConfig") {
mustRunAfter(tasks.generateClientCode)
}
}
Is there an alternative? Perhaps something more concise?