This is a comprehensive documentation for the dev.coolrequest.gosync Gradle plugin.
dev.coolrequest.gosync is a highly efficient deployment plugin for Gradle. It streamlines the process of transferring your application JAR and its dependencies to a remote server immediately after the build process.
Unlike traditional upload tools, goSync performs an MD5 checksum comparison between local files and remote files. It only uploads files that have changed, significantly reducing deployment time and bandwidth usage. It natively supports both standard SSH connections and JumpServer (Bastion Host) environments.
lib directory is in sync.Add the following block to your build.gradle file to configure the plugin:
goSync {
// Connection Settings
serverType = "jumpserver" // Options: "jumpserver" or "simple"
serverAddress = "192.168.1.100"
port = 2222
userName = "your_username"
userPass = "your_password"
// JumpServer Specific
afterConnectedCommand = "p\r25\r2\r"
// Remote Paths
libDirectory = "/your-libs"
mainJarDirectory = "/your-jar"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
serverType |
String | Yes | Defines the connection mode. • simple: Standard SSH connection.• jumpserver: Connects via a Bastion host that requires navigation commands. |
serverAddress |
String | Yes | The IP address or domain name of the JumpServer or the destination host. |
port |
Integer | Yes | The SSH port. Typically 22 for standard SSH or 2222 for JumpServer. |
userName |
String | Yes | Username for authentication. |
userPass |
String | Yes | Password for authentication. |
afterConnectedCommand |
String | No | Specific to JumpServer. A string representing the keyboard inputs needed to reach the destination machine. Use \r to represent the “Enter” key. Example: p\r25\r (Search ‘p’, then select item 25). |
libDirectory |
String | Yes | The absolute path on the remote server where the project’s dependency libraries (.jar files) should be stored. |
mainJarDirectory |
String | Yes | The absolute path on the remote server where the project’s primary output JAR should be stored. |
jar task (or the specific task producing the output).main.jar and all dependency JARs.serverType is set to jumpserver, the plugin opens an interactive session and “types” the afterConnectedCommand automatically to tunnel through to the internal server before initiating the SFTP transfer.To run the sync manually, you can execute:
./gradlew goSync
Or, if configured as part of the build pipeline, it will run automatically when you build the project:
Author: coolrequest
Plugin ID: dev.coolrequest.gosync