Launching groovyConsole from gradle (with gradle compile classpath)

This is my build file:

/*

  • This build file was generated by the Gradle ‘init’ task.

  • This generated file contains a sample Java Library project to get you started.

  • For more details take a look at the Java Libraries chapter in the Gradle

  • user guide available at The Java Library Plugin - Gradle User Guide Version 4.3

*/

// 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.

jcenter()

mavenCentral()

}

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’

// https://mvnrepository.com/artifact/org.codehaus.groovy/groovy

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 ‘com.google.guava:guava:23.0’

// 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