Launching groovyConsole from gradle (with gradle compile classpath)

This is my build file:



// Apply the java-library plugin to add support for Java Library

apply plugin: ‘java-library’

apply plugin: “groovy”

apply plugin: “application”

// In this section you declare where to find the dependencies of your project

repositories {

// Use jcenter for resolving your dependencies.

// You can declare any Maven/Ivy/file repository here.




task (console, dependsOn: ‘classes’, type: JavaExec) {

main = ‘groovy.ui.Console’

classpath = sourceSets.main.runtimeClasspath


dependencies {

// This dependency is exported to consumers, that is to say found on their compile classpath.

api ‘org.apache.commons:commons-math3:3.6.1’


runtime group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘3.0.0-alpha-3’

// This dependency is used internally, and not exposed to consumers on their own compile classpath.

implementation ‘’

// Use JUnit test framework

testImplementation ‘junit:junit:4.12’


Any idea what I do wrong?

Error is:
Execution failed for task ‘:console’.

Process ‘command ‘/Users/angelos/develop/tools/jdk-10.0.2.jdk/Contents/Home/bin/java’’ finished with non-zero exit value 1

I start it with: $ gradle console