I am migrating a Maven build into Gradle for a project relying on @Configurable Spring annotations, however when my (web) application is running none of the @Configurable classes are getting injected under the Gradle build (they were working fine built my Maven).
In Maven I used the following plugin:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.4</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> </aspectLibraries> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> For Gradle 1.0 I adapted the 0.9 ajc plugin (url below) but couldn't figure out how to add the configuration/aspectLibraries/spring-aspects into this:
apply plugin: 'war' apply plugin: 'jetty' sourceCompatibility = 1.6 version = 1.0 // Based on: http://github.com/breskeby/gradleplugins/raw/0.9-upgrade/aspectjPlugin/aspectJ.gradle configurations { ajc aspects ajInpath } task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true) { dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileJava") doLast{ ant.taskdef( resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) ant.iajc(source:sourceCompatibility, target:targetCompatibility, destDir:sourceSets.main.output.classesDir.absolutePath, maxmem:"512m", fork:"true", aspectPath:configurations.aspects.asPath, inpath:configurations.ajInpath.asPath, sourceRootCopyFilter:"**/.svn/*,**/*.java",classpath:configurations.compile.asPath){ sourceroots{ sourceSets.main.java.srcDirs.each{ pathelement(location:it.absolutePath) } } } } } dependencies { ajc group: 'org.aspectj', name: 'aspectjtools', version: '1.6.12' compile group: 'org.aspectj', name: 'aspectjrt', version: '1.6.12' compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.6.12' compile group: 'org.springframework', name: 'spring-jdbc', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-orm', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-aop', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-aspects', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-web', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-webmvc', version: '3.1.1.RELEASE' compile group: 'org.springframework', name: 'spring-expression', version: '3.1.1.RELEASE' } What do I need to do to get spring-aspects working in Gradle built web applications?
Thanks