Hello All,
I am trying to include multiple classpath for JavaExec
task. I got it somehow working, but could understand why. So I am seeking help here to really understand what’s happening.
build.gradle:
configurations {
scalaRepl
}
dependencies {
scalaRepl "org.scala-lang:scala-compiler:2.12.12"
}
- My working JavaExec task is below:
task repl(type:JavaExec) {
doFirst {
main = "scala.tools.nsc.MainGenericRunner"
classpath {
[
configurations.scalaRepl,
sourceSets.main.runtimeClasspath,
]
}
standardInput System.in
args '-usejavacp'
}
}
- This also works:
...
classpath = configurations.scalaRepl
classpath {
[
sourceSets.main.runtimeClasspath,
]
}
...
- This also works
classpath = configurations.scalaRepl + sourceSets.main.runtimeClasspath
But below classpath
setting doesn’t work:
classpath = configurations.scalaRepl
classpath = sourceSets.main.runtimeClasspath
I’m novice to groovy/gradle so really dont know why things are working. Would be nice if someone explains what is happening and what should be the correct way to combine multiple entries into one for classpath