I am trying to use two plugins com.diffplug.spotless
and org.jsonschema2dataclass
to force a specific coding style and to generate pojos from json schemas. However, after attempting to setup the build (sample below) I end up with an error about “declaring an explicit or implicit dependency”. While I’ve seen this discussed for tasks - I’m not sure how to solve the problem for plugins? Any help would be appreciated. Sample config and error messages below.
plugins {
id 'java'
id 'com.diffplug.spotless' version '6.4.1'
id 'org.jsonschema2dataclass' version '4.2.0'
}
group = 'org.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
jsonSchema2Pojo {
sourceType = 'jsonschema'
targetDirectoryPrefix = file("${project.buildDir}/generated/sources/annotationProcessor/java")
targetPackage = 'org.example.generated'
annotationStyle = 'gson'
outputEncoding = 'UTF-8'
targetVersion = '11'
}
spotless {
enforceCheck false
java {
importOrder('java', 'javax', 'com.example', '', '\\#com.example', '\\#')
removeUnusedImports()
}
}
build.dependsOn 'spotlessApply'
compileJava.dependsOn('generateJsonSchema2DataClass')
> Task :generateJsonSchema2DataClass0
Execution optimizations have been disabled for task ':generateJsonSchema2DataClass0' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/jeremy/Projects/git-hunter/build/generated/sources/annotationProcessor/java/main'. Reason: Task ':generateEffectiveLombokConfig' uses this output of task ':generateJsonSchema2DataClass0' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
> Task :spotlessJava
Execution optimizations have been disabled for task ':spotlessJava' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/jeremy/Projects/git-hunter/build/generated/sources/annotationProcessor/java'. Reason: Task ':spotlessJava' uses this output of task ':generateJsonSchema2DataClass0' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Users/jeremy/Projects/git-hunter/build/generated/sources/annotationProcessor/java/main'. Reason: Task ':spotlessJava' uses this output of task ':generateJsonSchema2DataClass0' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
> Task :compileJava
Execution optimizations have been disabled for task ':compileJava' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/jeremy/Projects/git-hunter/build/generated/sources/annotationProcessor/java/main'. Reason: Task ':spotlessJava' uses this output of task ':compileJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.