Can a build script refer to its own classpath?

I’m looking into what it would take to make the tomcat plugin be able to fork and run in a separate process. The first way that comes to mind for me to do this is to have the plugin include in itself a ‘main’ class that the plugin task will invoke with the proper arguments. The tricky thing I can’t figure out is: how do I set the classpath for the ‘project.javaexec { }’ call such that it includes the classpath of the buildscript itself (i.e. not just the ‘runtimeClasspath’ for the project).

I suppose I could create a separate configuration in the build file that calls this plugin, but it would be nice for the plugin to be able to configure itself, rather than needing to be told where it lives.

Thanks.

I think I may have found a way to do this actually:

project.buildscript.configurations[‘classpath’]