How do you retrieve the classpath of a plugin?

How do you retrieve the classpath of a plugin ? I want to start a java forked ant task from a groovy plugin and need to provide it the classpath of my plugin

My instinct was to look getProject().getBuildscript().getDependencies() but I can’t seem to figure out how to use this untyped undocumented api

Hmm i played around a bit more and this does more or less what i want :

Set pluginClasspath = getProject().getBuildscript().getConfigurations()


Is this the correct approach ?

It does for me raise the question of how plugins are isolated from one another since my understanding is that this will give me the classpath of all the plugins in the build script not just the dependencies of this one plugin. What happens if 2 plugins depend on 2 different non backwards compatible versions of a library ?

Can you explain in more detail what you are trying to achieve? Which Ant task is your plugin using, and why? And why does it need the plugin’s class path (rather than using some fixed class path)?

I am attempting to transform a series of ant files into a gradle plugin. One of the steps in the current build process is running a sass to css tool via ant’s “java” task. I figured it, at least for now, would be easiest to invoke the ant task from my grails plugin.

Right now i am doing this :

public class SassToCss extends ConventionTask {

private File sassDir;


public void sassToCss() {

if (getSassDir() == null || !getSassDir().exists()) {

throw new InvalidUserDataException(“Please specify a valid sassDir”);


Java javaTask = new Java();

javaTask.setTaskName(“sass to css builder”);


Set pluginClasspath = getProject().getBuildscript().getConfigurations()


Project antProject = getAnt().getAntProject();

Path classPath = new Path(antProject);

for (File dep : pluginClasspath) {









.setLine(“sass.dir=” + getSassDir());



… }

If you choose to run ‘SassToCssBuilder’ in an external process, you shouldn’t need to modify or pass on the build script class path. Just create a regular configuration (or, depending on the circumstances, file collection), put ‘SassToCssBuilder’ and its dependencies on it, and pass it on to ‘javaTask’.