Buildscript classpath in multi-project project


(Willie) #1

I am working with the IBM liberty plugin. It is basically a wrapper for an Ant library. But it has lines similar to this

    project.ant.taskdef(name: 'installLiberty',
                        classname: net.wasdev.wlp.ant.install.InstallLibertyTask.name,
                        classpath: project.buildscript.configurations.classpath.asPath)
    project.ant.installLiberty(params)

Now, if all the subprojects have their own individual build.gradle, this works. But, because of this issue

I can’t run multiple build.gradle files, i have to, have all the projects in one file. But, when i put the liberty tasks into one build.gradle file, i get this

Execution failed for task ':app-liberty:installLiberty'.
> taskdef class net.wasdev.wlp.ant.install.InstallLibertyTask cannot be found
   using the classloader AntClassLoader[]

Is there a reason why that classpath line will in the plugin works when the subproject has its own build.gradle file, but doesn’t work when everything is in one?

Oh, and if you have an answer for my other issue, that would help too.


(Willie) #2

BTW, i figured this out. I had to change all the

classpath: project.buildscript.configurations.classpath.asPath)

with

classpath: project.rootproject.buildscript.configurations.classpath.asPath)

That seems to have fixed it.