Gradle for Drool ant.taskdef

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Gradle for Drool ant.taskdef

ramanmann
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hi I am a newbee in Gradle and i am trying to compile some drool files using a ant tasks within Gradle.
I keep getting exception when i try to hook up ant.taskdef.Is there something wrong with the how i defined taskdef part ?

ConstraintEngine.groovy
****************************************************
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.Exec
import org.gradle.api.tasks.Copy

class ConstraintEngine extends DefaultTask  {
   void setRules() {
    //  project.clean.delete 'webservices'      
      File file1 =new File(project.projectDir.toString()+'src/conf/changesets')
      File file2 =new File(project.projectDir.toString()+'src/conf/rulesets')

      project.task('CopyRBaseToSrc', type:Copy) {
         from project.projectDir.toString() + "/conf/**.rbase"
         into project.projectDir.toString() + "/src/"
      }
   
         def t=project.task('DoConstraints', type:DefaultTask){
            ant.taskdef(name: 'CompileRules', classname: 'com.o.project.project.consteng.common.utils.CompileRulesTask', classpath: project.configurations.constraints.asPath)
            ant.CompileRules(
                                changeSet:file1,
                                ruleBaseExt:".rbase" ,
                                ruleSet:file2
            )

         
         //t.inputs.file new File(item[0])
         //t.outputs.dir new File(project.projectDir.toString() + "/webservices/")
         t.dependsOn project.constraintEngineCompile
         project.CopyRBaseToSrc.dependsOn t
      }
    //  project.sourceSets.main.java.srcDirs=[project.projectDir.toString() + '/combined/']
      project.compileJava.dependsOn project.CopyRBaseToSrc
      project.CopyRBaseToSrc.dependsOn project.constraintEngineCompile
   }
}

***************************************************8





        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: : java.lang.NullPointerException
        at com.o.project.wire.consteng.common.utils.CompileRulesTask.execute(CompileRulesTask.java:57)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
        at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
        at ConstraintEngine$_setRules_closure2.doCall(ConstraintEngine.groovy:19)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:110)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:439)
        at org.gradle.api.internal.project.AbstractProject.task(AbstractProject.java:948)
        at org.gradle.api.Project$task$0.call(Unknown Source)
        at ConstraintEngine.setRules(ConstraintEngine.groovy:17)
        at build_4hcaft7s3cn8gevi3tttkmhalh$_run_closure5.doCall(C:\Views\project_gradle\project\project\BL\ProjectConstraintEngine\build.gradle:82)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:110)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:439)
        at org.gradle.api.internal.project.Abstraprojectroject.task(Abstraprojectroject.java:948)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:225)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:129)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
        at build_4hcaft7s3cn8gevi3tttkmhalh.run(C:\Views\project_gradle\project\project\BL\ProjectConstraintEngine\build.gradle:81)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
        ... 171 more
Caused by: java.lang.NullPointerException
        at com.o.project.project.consteng.common.utils.CompileRules.checkRules(CompileRules.java:126)
        at com.o.project.project.consteng.common.utils.CompileRulesTask.execute(CompileRulesTask.java:54)
        ... 195 more