Ondrej’s code seems to contain a number of things specific to his build. I managed to remove them and was left with the following that seems to work in my build, and use the same configuration notation as the original plugin. It would be nice if this could be incorporated into a new plugin or patched back into the old one.
compileJava {
actions = [];
def subModules = configurations.compile.getDependencies().withType(ProjectDependency.class).collect {
it.dependencyProject
}
doFirst {
println(“Compiling aspects…”)
inputs.files project.sourceSets.main.java.srcDirs
outputs.files project.sourceSets.main.output.classesDir
ant.taskdef(resource: “org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties”,
classpath: project.rootProject.configurations.ajc.asPath)
ant.iajc(
source: project.sourceCompatibility,
target: project.targetCompatibility,
destDir: project.sourceSets.main.output.classesDir.absolutePath,
maxmem: “512m”,
fork: “false”,
//encoding: project.rootProject.compilationEncoding,
//debug: project.rootProject.compilationDebug,
//debugLevel: project.rootProject.compilationDebugLevel,
aspectPath: project.rootProject.configurations.aspects.asPath,
sourceRootCopyFilter: “/.svn/*,/*.java”,
classpath: project.configurations.compile.asPath,
excludes: “/run_time//*”
) {
srcdir { //do not use sourceroot definition, because of excludes
project.sourceSets.main.java.srcDirs.each {
pathelement(location: it.absolutePath)
}
}
}
///compile run_time aspects
project.sourceSets.main.java.srcDirs.each { dir ->
ant.javac(
source: project.sourceCompatibility,
target: project.targetCompatibility,
srcDir: dir,
destDir: project.sourceSets.main.output.classesDir.absolutePath,
fork: false,
//encoding: project.rootProject.compilationEncoding,
//debug: project.rootProject.compilationDebug,
//debugLevel: project.rootProject.compilationDebugLevel,
classpath: project.configurations.compile.asPath,
includes: “/run_time//*.java”
)
}
}
}
There’s still some additional stuff to cleanup however as I am getting these messages: Calling TaskInputs.files(Object…) after task execution has started has been deprecated and is scheduled to be removed in Gradle 2.0. Check the configuration of task ‘:compileJava’. Calling TaskOutputs.files(Object…) after task execution has started has been deprecated and is scheduled to be removed in Gradle 2.0. Check the configuration of task ‘:compileJava’.