Upload via SCP with Gradle

Inside a Java module build by Gradle, I want to upload the resulting JAR(s) of my project to a remote location which is reachable via SSH/SCP. All examples I found did not work inside my environment. …