aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2023-04-15 16:16:35 +0200
committerJulien Gouesse <[email protected]>2023-04-15 16:16:35 +0200
commit26c31afcc9439324c355ec6c968aad232ae63419 (patch)
treeb99e8d81779a7c4a8e323bf69abffb19f0fb058e
parenta879d7438f71911b5725af47877314beca64dee4 (diff)
Publishes all Maven publications produced by this project to the remote JogAmp Maven repository with Gradle
-rw-r--r--.gitignore3
-rw-r--r--build.gradle40
2 files changed, 41 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index ca882ea..4a2e1aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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: '**/**')
+ }
+ }
+ }
+}