diff options
author | Julien Gouesse <[email protected]> | 2023-04-15 16:16:35 +0200 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2023-04-15 16:16:35 +0200 |
commit | 26c31afcc9439324c355ec6c968aad232ae63419 (patch) | |
tree | b99e8d81779a7c4a8e323bf69abffb19f0fb058e | |
parent | a879d7438f71911b5725af47877314beca64dee4 (diff) |
Publishes all Maven publications produced by this project to the remote JogAmp Maven repository with Gradle
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | build.gradle | 40 |
2 files changed, 41 insertions, 2 deletions
@@ -5,4 +5,5 @@ target/ .settings/ .project .classpath -ardorSettings.properties
\ No newline at end of file +ardorSettings.properties +gradle.properties diff --git a/build.gradle b/build.gradle index a5a7e52..465194d 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,44 @@ artifacts.archives packageSources dependencies { testImplementation group: 'junit', name: 'junit', version:'4.13.2' testImplementation group: 'org.easymock', name: 'easymock', version:'5.1.0' -} + } } + +// SSH upload with Ant: https://blog.mrhaki.com/2009/12/gradle-goodness-using-optional-ant-task.html +configurations { + sshAntTask +} + +repositories { + mavenCentral() +} + +dependencies { + sshAntTask 'org.apache.ant:ant-jsch:1.10.13', 'com.jcraft:jsch:0.1.55' +} + +tasks.register('publishToJogAmpMavenArdor3d') { + description = 'Publishes all Maven publications produced by this project to the remote JogAmp Maven repository.' + group = "Publishing" + + def passphrase = project.property('JogAmpScpPassword') + + // Redefines scp Ant task, with the classpath property set to our newly defined sshAntTask configuration classpath. + ant.taskdef(name: 'scp', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', + classpath: configurations.sshAntTask.asPath) + + doLast { + // Invokes the scp Ant task. (Use gradle -i to see the output of the Ant task.) + ant.scp(todir: '[email protected]:/srv/www/jogamp.org/deployment/maven-ardor3d/org/jogamp/', + keyfile: '${user.home}/.ssh/id_rsa', + passphrase: passphrase as String, // Use phassphrase entered by the user. + sftp: 'false', + trust: 'true', + verbose: 'true') { + fileset(dir: '${user.home}/.m2/repository/org/jogamp/ardor3d') { + include(name: '**/**') + } + } + } +} |