Hi! I have a task that needs to generate outputs b...
# community-support
t
Hi! I have a task that needs to generate outputs based on classpath input, i.e. there is a specific configuration that collects dependencies that should then be put on the classpath of the executing task, so it can reflectively search for annotations. Previously this was a standalone Java program that was executed in Gradle via JavaExec, so the classpath of the execution could simply be set, but I want to inline the implementation to get rid of the external artifact. What would be the easiest way of doing that? Should I keep the code executable via JavaExec and just somehow have the compile step of the program (and it's generated
Main.class
) being a dependency of the task? Can I extend the classpath for the task somehow? What would you do?
v
Sounds like you could use the worker API with classpath isolation to achieve what you want.
👆 1
t
Hah, indeed, WorkerApi is working just slick, the provided example (https://docs.gradle.org/current/userguide/worker_api.html#step_3_change_the_isolation_mode) is just what I need! Now that API is a thing to remember, never thought it would become handy for non-parallel execution, thanks a bunch!
👌 1