Join 10350+ others. No spamming.
I promise!

Follow us at github.



Gradle SSH Plugin Build Status Gradle Status

Gradle SSH Plugin provides SSH facilities such as command execution or file transfer on Gradle.

Read the document for details, and get the template project for quick start.

Getting Started

Add the plugin into your build script.

plugins {
  id 'org.hidetake.ssh' version '1.1.4'

Define remote hosts and describe SSH operations in the task.

remotes {
  webServer {
    host = ''
    user = 'jenkins'
    identity = file('id_ecdsa')

task deploy << { {
    session(remotes.webServer) {
      put 'example.war', '/webapps'
      execute 'sudo service tomcat restart'


This is an open source software licensed under the Apache License Version 2.0. Feel free to open issues or pull requests.


Gradle SSH Plugin internally uses Groovy SSH library. It depends on JSch.

The document is maintained on the repository of Groovy SSH.

Acceptance Test

We can run acceptance tests to verify behavior of the plugin on Gradle environment.


  • SSH service must be started on localhost port 22
  • Current user must be able to log in with a private key placed at ~/.ssh/id_rsa without any passphrase
  • SSH service must accept SFTP subsystem

Run test task.

./gradlew install
./gradlew -p acceptance-tests test

Some tests need to change the system configuration so they are separated to testWithSideEffect task. It should be run on a disposable container such as Travis CI or Docker.


Build with JDK 7 for compatibility. Do not build with JDK 8.

Push a versioned tag to GitHub and Travis CI will upload the artifact to Bintray.