Skip to content

Commit

Permalink
Adding a gradle repl
Browse files Browse the repository at this point in the history
  • Loading branch information
fkautz committed Jul 13, 2015
1 parent f387196 commit faf6b23
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,30 @@ jar {
attributes("Minio-Client-Java-Version": version)
}
}

/*
* Courtesy https://discuss.gradle.org/t/running-groovy-shell-from-gradle-task/6075/3
*/
configurations {
console
}
dependencies {
console 'commons-cli:commons-cli:1.2'
console('jline:jline:2.12.1')
console 'org.codehaus.groovy:groovy-groovysh:2.4.+'
}
task(console, dependsOn: 'classes') << {
def classpath = sourceSets.main.runtimeClasspath + configurations.console
def command = [
'java',
'-cp', classpath.collect().join(':'),
'org.codehaus.groovy.tools.shell.Main',
'--color',
'--terminal', 'unix']
def proc = new ProcessBuilder(command)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectInput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor()
}

0 comments on commit faf6b23

Please sign in to comment.