This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'groovy' | |
apply plugin: 'eclipse' | |
dependencies { | |
groovy localGroovy() | |
} | |
task execGroovy (type: JavaExec) { | |
classpath = sourceSets.main.runtimeClasspath | |
main = "example.Script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'eclipse' | |
task execJava (type: JavaExec) { | |
classpath = sourceSets.main.runtimeClasspath | |
main = "example.Main" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'eclipse' | |
compileJava.options.encoding = 'UTF-8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ant.condition(property: "os", value: "windows") { os(family: "windows") } | |
ant.condition(property: "os", value: "unix" ) { os(family: "unix") } | |
task execCommandLine(type:Exec) { | |
switch(ant.properties.os){ | |
case 'windows': | |
commandLine 'cmd', '/c', 'echo', 'hello' | |
break | |
case 'unix': | |
commandLine 'echo', 'hello' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks.addRule("Pattern: sample<ID>") { String taskName -> | |
if (taskName.startsWith("sample")) { | |
task(taskName) << { | |
println taskName - 'sample' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.sql.Sql | |
apply plugin: 'groovy' | |
apply plugin: 'eclipse' | |
apply plugin: 'maven' | |
repositories { mavenCentral() } | |
configurations { driver } | |
dependencies { driver 'org.xerial:sqlite-jdbc:3.7.2' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting implements Plugin<Project> { | |
void apply(Project project) { | |
project.task('first', type: FirstTask) | |
project.task('second', type: SecondTask) | |
.dependsOn('first') | |
} | |
} | |
class FirstTask extends DefaultTask { | |
@TaskAction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ant.condition(property: "os", value: "windows") { os(family: "windows") } | |
ant.condition(property: "os", value: "unix" ) { os(family: "unix") } | |
task gitInit(type:Exec){ | |
group = 'Git' | |
description = 'git init' | |
workingDir '.' | |
switch(ant.properties.os){ | |
case 'windows': | |
commandLine 'cmd', '/c', 'git', 'init' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'eclipse' | |
apply plugin: 'maven' | |
configurations { jgit } | |
repositories { | |
mavenRepo url: 'http://download.eclipse.org/jgit/maven' | |
mavenCentral() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This task raises IOException | |
task copyToProjectDir(type: Copy) { | |
from 'test1/test1.txt' | |
into '.' | |
} | |
// Workaround using ant property | |
task copyToProjectDir1 << { | |
ant.copy(file: 'test1/test1.txt', todir: '.') | |
} |