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. There is also an example how to use SCP inside the Gradle tutorial: http://gradle.org/docs/current/userguide/maven_plugin.html (search for "Example 38.4. Upload of file via SSH"). I adapted the example a bit and now have this build.gradle:
apply plugin: 'java'
apply plugin: 'maven'
description = "User Service Implementation"
repositories {
mavenCentral()
}
configurations {
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}
uploadArchives {
repositories.mavenDeployer {
name = 'sshDeployer' // optional
configuration = configurations.deployerJars
repository(url: "scp://miniappserver") {
authentication(userName: "root", password: "test")
}
}
}
But when I test that script I'm getting this error:
$ gradle uploadArchives -q
FAILURE: Build failed with an exception.
* Where:
Build file '/home/ifischer/git/userservice/implementation/build.gradle' line: 11
* What went wrong:
A problem occurred evaluating project ':implementation'.
Cause: Could not find method deployerJars() for arguments [org.apache.maven.wagon:wagon-ssh:2.2] on project ':implementation'.
What am I doing wrong? Can anybody provide a complete working example?
[should post that question to the gradle-user mailing list, but it's currently down...]
As kindly replied on the Gradle Mailing list (sorry for double posting) I had to remove the "org.apache.maven.wagon:wagon-ssh:2.2"
inside the configurations-task:
(...)
configurations {
deployerJars
}
(...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With