Skip to content
Zealin edited this page Dec 5, 2012 · 3 revisions

Simple Example

Gradle Deploy Plugin

Current working deploy scenarios:

  • lancopy
    stops specified running tomcat service, copy the artifacts into the desired server directory(appends /webapps/, clears log and work directory) and then starts the tomcat service
  • upload
    uploads all files and folders from specified directory to target host (using ssh (scp))

You can not use the gradle deploy command without specifying at least one configuration in build.gradle

If there is more than one configuration you have to use gradle deploy -PdepConfig=confName or an exception will be thrown

Example (there are currently no default values) with 3 deploy configurations (2 lancopy, 1 upload) (if there is only one configuration you can use the gradle deploy command without extra parameter.

apply plugin: 'cat-deploy'

deploy {
	anyName {
		type = 'lancopy'
		tomcatHost = '\\\\\\\\HOSTNAME'
		tomcatService = 'SERVICENAME'
		webappWar = 'artifacts'
		webappDir = '\\\\\\\\HOSTNAME\\\\PATH\\\\...'
	}
	otherName {
		type = 'lancopy'
		tomcatHost = '\\\\\\\\HOSTNAME'
		tomcatService = 'SERVICENAME'
		webappWar = 'artifacts'
		webappDir = '\\\\\\\\HOSTNAME\\\\PATH\\\\...'
	}
	example {
		type = 'upload'
		webappDir = 'artifacts'
		uploadTarget = 'xyz.example.catalysts.cc'
		uploadDir = '/some/path/example'
		username = '...'
		password = '...'
	}
}

type lancopy:
will upload all files from given webappWar directory

type upload:
will upload all files from given webappDir directory
it will create all needed folder specified by uploadDir path
does work with spaces in file / folder names


###Error handling: scp: "some remote path": No such file or directory
If you receive this message the uploadDir or one of his folders does not exist. Deploy only uses the command "mkdir" without the -p flag

Clone this wiki locally