I have another general question about up-to-dateab...
# community-support
s
I have another general question about up-to-dateability of tasks, in particular JAR tasks, in conjunction with a Gradle plugin I use that sets a Gradle project's version based on the Git history: So, the JAR task encodes the version into the name of the JAR. Which means when the version changes, the task is not up-to-date as the expected output is missing. This is particularly bad for big multi-projects that all share the same version, because if I just commit a small change in a single module, that changes the version for all projects, and all JAR tasks get rerun. Any recommendation how to avoid that?
t
a Gradle plugin I use that sets a Gradle project's version based on the Git history
can you disable that behavior for local builds and only do it when actually publishing?
s
Well, that might be possible, but I'd also like to get the correct version (e.g. in the UI of the application) during development.
t
I like to configure Jar tasks not to include the version in the file name:
Copy code
tasks.withType<Jar>().configureEach {
    // Don't include the version in the JAR filename
    archiveVersion.unsetConvention()
}
s
Hmm, so there's no way to tell Gradle that a JAR (i.e. its contents) did not change, but that it's just available under a different name?
v
If it is used as a
@Classpath
or
@CompileClasspath
names might be ignored. If it is used as some input file with
@PathSensitivity(NONE)
, the name is ignored. But in other cases where it is used as input file with at least
NAME_ONLY
sensitivity, the file name is significant.
💡 1