I’m thinking of changing the manifest of a jar or the jar name itselfs every time some changes are detected. I.e. so long a “gradle build” prints “up-to-date” I want to keep the jar name unchanged. In all other cases I want to create a new version.
About changing the manifest without re-generating the jar - there was already a similar question - how one could exclude certain manifest headers from the up-to-date check, see Input files upTodate-check customization. About jar filename - I think that if you change the version, the jar task will always re-execute as it checks whether the output jar file is available or not. You could probably change the filename after the jar task executes, but then you will have to also adjust the name of the artifact that it adds to the ArtifactHandler, otherwise you will not be able to upload this artifact and other projects will not be able to resolve it.
In the Gradle build, we use the modification date of the most recently modified source file. This is a reasonable approximation, and avoids this problem.