Using configurations from inside a plugin using asPath - ant taskdef use case


(Sion Williams) #1

Theres an ant plugin I would like to use to form a gradle plugin so that I can distribute at my company. It should be simple, and some examples I’ve seen would indicate it is, but I get the following error:

groovy.lang.MissingPropertyException: Could not find property 'antcp' on configuration container.

when

configurations {
    antcp
}
  dependencies {
    antcp 'com.dbdeploy:dbdeploy-ant:3.0M3'
}

and

class DBDeployPlugin implements Plugin <Project> {
      @Override
    void apply(Project project){
          project.ant.taskdef (name: "dbdeploy", classname: "com.dbdeploy.AntTarget", classpathref: project.configurations.antcp.asPath)
          // Create and install custom tasks
        project.task('generateChangeLog') {
            group = 'DBDeploy'
            description = 'Generate an SQL update script'
              doLast{
                // use dbdeploy to generate the change script
                project.ant.dbdeploy(driver: ${driver},
                        url: ${url},
                        userid: ${userid},
                        password: ${password},
                        dir: ${dir})
            }
        }

Projects can be found, here:

https://github.com/willis7/dbdeploy-gradle-plugin

Any help would be gratefully received.