How to do the aspectj compile time weaving in groovy without ant


(dilipkily) #1

I have the below gradle script written. However as you could see that I am using ant.taskdef and ant.iajc for compile time weaving. Please help me out on how to get this done without ant taskdef or ant.iajc using gradle/groovy.

compileJava {
sourceCompatibility="1.6"
targetCompatibility=“1.6”

doLast{
ant.taskdef( resource:“org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties”, classpath: configurations.ajc.asPath)
ant.iajc(source:“1.6”, target:“1.6”, destDir:sourceSets.main.output.classesDir.absolutePath, maxmem:“512m”, fork:“true”,
aspectPath:configurations.aspects.asPath}, sourceRootCopyFilter:"/.svn/*,/*.java",classpath:"${configurations.compile.asPath};${configurations.aspectCompile.asPath}"){
sourceroots{
sourceSets.main.java.srcDirs.each{
pathelement(location:it.absolutePath)
}
}
}
}
}