Assemble iajc Ant task classpath w/ folders that exist

Prior to this commit, the [ant:iajc] tasks logged numerous warnings
regarding incorrect classpath entries. The reason is that the classpath
was constructed with paths that do not physically exist in the file
system (e.g., for projects that do not have test classes or test
folders (yet)).

This commit picks up where ef75bd8 left off and addresses this issue by
assembling the runtime classpath passed to the iajc task with folders
and JARs that actually exist in the filesystem.
master
Sam Brannen 10 years ago
parent 789d904658
commit 6861d35ea0
  1. 11
      spring-aspects/aspects.gradle

@ -25,6 +25,9 @@ compileJava {
ext.targetCompatibility = project(":spring-core").compileJava.targetCompatibility
doLast{
// Assemble runtime classpath from folders and JARs that actually exist
def runtimeClasspath = project.files(sourceSets.main.runtimeClasspath.files.findAll({ it.exists() }))
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
classpath: configurations.ajc.asPath)
@ -34,7 +37,7 @@ compileJava {
aspectPath: configurations.aspects.asPath,
inpath: configurations.ajInpath.asPath,
sourceRootCopyFilter: "**/*.java,**/*.aj",
classpath: (sourceSets.main.runtimeClasspath + configurations.rt).asPath) {
classpath: (runtimeClasspath + configurations.rt).asPath) {
sourceroots {
sourceSets.main.java.srcDirs.each {
pathelement(location:it.absolutePath)
@ -56,9 +59,11 @@ compileTestJava {
ext.sourceCompatibility = project(":spring-core").compileTestJava.sourceCompatibility
ext.targetCompatibility = project(":spring-core").compileTestJava.targetCompatibility
ext.pathSeparator = System.getProperty('path.separator')
doLast{
// Assemble runtime classpath from folders and JARs that actually exist
def runtimeClasspath = project.files(sourceSets.test.runtimeClasspath.files.findAll({ it.exists() }))
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
classpath: configurations.ajc.asPath)
@ -67,7 +72,7 @@ compileTestJava {
destDir: outputDir.absolutePath,
aspectPath: jar.archivePath,
inpath: configurations.ajInpath.asPath,
classpath: sourceSets.test.runtimeClasspath.asPath + pathSeparator + jar.archivePath + pathSeparator + configurations.rt.asPath) {
classpath: (runtimeClasspath + project.files(jar.archivePath) + configurations.rt).asPath) {
sourceroots {
sourceSets.test.java.srcDirs.each {
pathelement(location:it.absolutePath)

Loading…
Cancel
Save