I have the below build.gradle file. The task assignVersion generates a file from a template that needs to be included in the distribution zip file created by distZip.
If I run this in gradle 7.2 I get warning that are show below. I am not at all understanding what is causing this and how to resolve this without adding a lot of dependsOn.
plugins {
id 'java-library'
id 'distribution'
}
version="1.0"
sourceSets {
main {
java.srcDirs = ['src']
}
}
task assignVersion(type: Copy) {
destinationDir = projectDir
from projectDir
include "**/*.template"
rename '(.+).template', '$1'
filter { line ->
line.replaceAll("test.version.number", "${version}")
}
}
jar {
archiveBaseName = "test"
includeEmptyDirs = false
manifest {
attributes 'Implementation-Title': "Test",
'Implementation-Version': archiveVersion
}
}
distZip {
into "test", {from projectDir include "myfile", "config/*.cfg"}
into "test/code/jars", {from jar}
}
distZip.dependsOn(assignVersion)
Here is the output:
> 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: 'C:\Users\rupin\git\test\build\classes\java\main'. Reason: Task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\build\generated\sources\annotationProcessor\java\main'. Reason: Task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\build\generated\sources\headers\java\main'. Reason: Task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\src'. Reason: Task ':compileJava' uses this output of task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
> Task :jar
Execution optimizations have been disabled for task ':jar' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\build\classes\java\main'. Reason: Task ':jar' uses this output of task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\build\resources\main'. Reason: Task ':jar' uses this output of task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'C:\Users\rupin\git\test\build\tmp\jar\MANIFEST.MF'. Reason: Task ':jar' uses this output of task ':assignVersion' 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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.