Gradle中外部命令API

本文记录Java学习过程中遇到的Gradle中外部命令API~

外部命令的使用:

task('taskname') {
	doLast {
		def sourcePath = 'sourcePath'
		def targetPath = 'targetPath'
		def command = "mv -f ${sourcePath} ${targetPath}"
		exec {
			try {
				executable 'bash'
				args '-c', command
				println 'success'
			} catch (Exception e) {
				println 'fale'
			}
		}
	}
}

标签: none