Hi,
I’ve written a custom task in Kotlin and located it inside buildSrc
as recommended. The custom task calls javaexec
. Something like this:
private fun custom() {
project.javaexec {
main = "com.thirdParty.something.Main"
classpath = ???
args("...")
}
}
Some questions:
- Is
project.javaexec
the best way to call a main method from within a custom task? - How can I configure classpath such that
com.thirdParty.something.Main
remains a dependency of the custom task (i.e.buildSrc/build.kotlin.kts
), and not the main project?
Thanks!