I see. That makes sense! And perhaps explains why I’m seeing some errors during runtime with my solution.
So I’m trying yours by adding it to my subprojects task
configure(mySubProjects()){
...
configurations {
javaExec
}
configurations.javaExec.extendsFrom it.configurations.runtime
...
}
and then in myTask
task myTask(type: JavaExec) {
...
classpath = configurations.javaExec
...
}
Which fails when I run it from the root project
gradle myTask
with
> Could not find property 'javaExec' on configuration container.
As I mentioned I’m trying…
Possibly I could add it on the root project too, in build.gradle:
configure(project) {
configurations {
javaExec
}
configurations.javaExec.extendsFrom project.configurations.runtime
}
Although I wish I didn’t have to do that (which actually relates to my other question:
does-root-in-multiproject-needs-to-be-configured)
it makes the error “task not found” go away,
But then I’m getting “Error: Could not find or load main class”
as your solution only includes external dependencies. And not my internal subprojects.
jars like log4j etc are there, but not my subprojectx.jar etc.
How could I include those too?