I would like to create a custom task in gradle, that will upload assembled jar to a remote server.
My best working result is
doLast {
ssh.run {
def jarFile = "${jar.baseName}-${version}.jar"
session(remotes.role('qa')) {
put from: file("build/libs/${jarFile}"), into: "/home/${user}"
execute("sudo cp ${jarFile} /usr/share/feedserver/", pty: true)
...
}
}
}
However this uses jar.baseName property, which is deprecated and gives a warning:
The baseName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveBaseName property instead.
What would be the right way replacing it ?
Suggested archiveBaseName does not work, E.g.
task updateOnQA(dependsOn: bootJar) {
doLast {
def jarFile = "${jar.archiveBaseName}-${version}.jar"
print "${jarFile}";
}
}
Outputs
task ':myproject:jar' property 'archiveBaseName'-1.0.12.jar