AspectJ plugin : How to avoid ant task

I am able to do compile time weaving, but is there any way to avoid ant task executions.
I want to avoid ant.taskdef
ant.aijc calls from Gradle task. Seems to be the aspect plugin support is not available in Gradle with higher version.

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)
}
}
}
}
}

Any luck please. Please suggest

Hi,

I wrote a plugin calling the ajc compiler from a task bypassing the need for the ant task.
Unfortunately, I am not allowed to share the code due to licence restrictions. The global idea is:

// Initialize the ajc compiler and forward gradle logger to ajc
Main ajc = new Main()
ajc.holder = new YourAdaptor(project.logger)
// Fill options
List options = []
options << '--encoding' << 'UTF-8'
// ...
ajc.runMain options as String[], false

The ajc compiler reference can be found here: http://www.eclipse.org/aspectj/doc/next/devguide/ajc-ref.html
Most important options to set in my mind are:
-d (output directory)
-aspectpath (where your aspect come from, can use jar files and/or directories)
-inpath (where your point cuts are defined)
-XSet if you need to set some options like avoidFinal=true when running on JBoss Wildfly for example, …
-classpath (self descriptive)
-source and -target

Try your luck on github, I think there might be some open source available there. Also giving a look to the ant task source code might help you.
Good luck