Message about archiveVersion seems misleading or incomplete...?

In my gradle.build, I have

 jar {
   manifest {     
     attributes 'Implementation-Title': 'JavaFBP', 'Implementation-Version':version,      
     "Class-Path": configurations.compileClasspath.collect { it.getName() }.join(' '),       
      'Main-Class' : mainClassName
    }          

and got this message:

The AbstractArchiveTask.version property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveVersion property instead. See https://docs.gradle.org/6.2/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:version for more details.

However, when I changed ‘version’ to ‘archiveVersion’, the manifest in my jar file showed the wrong version number (using ‘version’ gives the correct version number). What am I missing?!

PS I am using Gradle 6.2.1 on a Win10 machine

Thanks!

Just occurred to me: maybe I have to set archiveVersion explicitly - if so, does this mean that version and archiveVersion can have different values? If so, why?

Apparently archiveVersion only applies to the ‘jar’ task, not ‘publishing’… Anybody have an explanation? Also, the error message could have been a bit more explicit…!

I’ve been confused about this too. My understanding is that the top level version property is not deprecated, only the version property in the archive tasks. I believe the archiveVersion is automatically populated from the project.version (at least in a java project) but it sounds like you’re not seeing that?

You’re right, I didn’t see that. I am now using archiveVersion for jar file creation, and version for everything else. This seems to suggest that the Gradle designers want to allow these to be different… but why would they want to?

So what’s the fix? It isn’t clear how severe the error is.

"The AbstractArchiveTask.version property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveVersion property instead. See https://docs.gradle.org/6.2.2/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchi
veTask:version for more details."

It is refering to this version correct?
group = “com.blah.blah”
version = "1.0-SNAPSHOT"
buildDir = file(“out”)

How do you set the archiveVersion, AbstractArchiveTask().archiveVersion = doesn’t work.

This still seems confusing: in the jar section of my build.gradle I have
archiveVersion = '2.20.10'
manifest {
attributes 'Implementation-Title': ...', 'Implementation-Version': archiveVersion,'etc.

which seems pretty explicit, but I still have to fill in the manifest version no. by hand! Any idea why?!