Here’s the problem: I want to execute some java class with some dependencies from, say, runtime configuration. How can this be done?
task runJava(type: JavaExec, dependsOn:[classes]) {
main = 'mypackage.MyClass'
classpath = //what should I write here to provide classes from runtime configuration?
}
You will probably want to use the runtime classpath of your Source sets which includes the compiled classes of your project as well as all the runtime dependencies.
In case you want to the get the path of a specific configuration you can do something like this:
configurations.getByName('runtime').asPathor shorterconfigurations.runtime.asPath.