You should be able to put the version outside the “jar” section, something like:
version = '0.0.1'
group = 'org.foo'
jar {
manifest {
attributes 'Implementation-Title': 'Foo', 'Implementation-Version': archiveVersion
}
}
The jar task by default sets archiveVersion = project.version (‘0.0.1’)
The publishing section should do the same, i.e. taking the version from project.version unless you override it.