From 6861d35ea0b8ff62c3c2b39ccda2f6a3c555839d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 7 Mar 2015 18:43:14 +0100 Subject: [PATCH] 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. --- spring-aspects/aspects.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spring-aspects/aspects.gradle b/spring-aspects/aspects.gradle index e1fe65b8e4a..2c68dff4da9 100644 --- a/spring-aspects/aspects.gradle +++ b/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)