Why aspectj can't find aop.xml when running tests with gradle?

I am trying to run some junit tests with aspectj using gradle. Since I want to user LTW I did the following:

task myTest(type: Test) {
 jvmArgs '-javaagent:libs/aspectjweaver-1.6.12.jar'
}

My aop.xml is located at src/test/resources/META-INF. Still, when I run ‘gradle myTest’ aspectj is not able to find it’s configuration. Using the debug output I get:

… 11:28:13.401 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Started Gradle Worker 1. 11:28:13.620 [ERROR] [system.err] [AppClassLoader@43be2d65] info AspectJ Weaver Version 1.6.12 built on Tuesday Oct 18, 2011 at 17:52:06 GMT 11:28:13.621 [ERROR] [system.err] [AppClassLoader@43be2d65] info register classloader sun.misc.Launcher$AppClassLoader@43be2d65 11:28:13.621 [ERROR] [system.err] [AppClassLoader@43be2d65] info no configuration found. Disabling weaver for class loader sun.misc.Launcher$AppClassLoader@43be2d65 11:28:13.662 [ERROR] [system.err] [ExtClassLoader@7a9664a1] info AspectJ Weaver Version 1.6.12 built on Tuesday Oct 18, 2011 at 17:52:06 GMT 11:28:13.662 [ERROR] [system.err] [ExtClassLoader@7a9664a1] info register classloader sun.misc.Launcher$ExtClassLoader@7a9664a1 11:28:13.663 [ERROR] [system.err] [ExtClassLoader@7a9664a1] info no configuration found. Disabling weaver for class loader sun.misc.Launcher$ExtClassLoader@7a9664a1 11:28:13.692 [ERROR] [system.err] [URLClassLoader@6627e353] info AspectJ Weaver Version 1.6.12 built on Tuesday Oct 18, 2011 at 17:52:06 GMT 11:28:13.693 [ERROR] [system.err] [URLClassLoader@6627e353] info register classloader java.net.URLClassLoader@6627e353 11:28:13.693 [ERROR] [system.err] [URLClassLoader@6627e353] info no configuration found. Disabling weaver for class loader java.net.URLClassLoader@6627e353 …

I have also checked that META-INF/aop.xml is actually copied to build/resources/test and it looks ok. The folder is also included to the classpath.

Actually I am not sure if this is really a gradle problem. It might be something else. In any case, perhaps there is some issue concerning gradle and aspectj and someone knows about this and can help.

Thanks, Conrad

Does the problem go away when you do this?

sourceSets.all {
  output.resourcesDir = output.classesDir
}

No, the result is the same.