Spring 渐变5:未能应用插件[id';aspectj';]

Spring 渐变5:未能应用插件[id';aspectj';],spring,gradle,build.gradle,Spring,Gradle,Build.gradle,我正在尝试运行一个build.gradle文件,它看起来像这样,并在apply plugin的第行返回一个错误:“aspectj” 错误消息如下所示: FAILURE: Build failed with an exception. * Where: Build file '/home/me/Spring/pro-spring-5-master/chapter05/aspectj-aspects/build.gradle' line: 17 * What went wrong: A prob

我正在尝试运行一个build.gradle文件,它看起来像这样,并在apply plugin的第行返回一个错误:“aspectj”

错误消息如下所示:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/me/Spring/pro-spring-5-master/chapter05/aspectj-aspects/build.gradle' line: 17

* What went wrong:
A problem occurred evaluating project ':chapter05:aspectj-aspects'.
> Failed to apply plugin [id 'aspectj']
   > Could not find method deleteAllActions() for arguments [] on task ':chapter05:aspectj-aspects:compileJava' of type org.gradle.api.tasks.compile.JavaCompile.


我做错了什么?

AspectJ与Gradle 5.0不兼容-请参阅问题和解决方案


最容易的可能是;例如,
io.freefail.aspectj.post-compile-weaving
,因为
aspectj.gradle
最近一次更新是在2年前(它似乎被放弃了)。

我已经解决了这个问题,并向jcenter发布了一个新版本。在这里找到它:

目前您需要:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
       classpath 'io.github.zebalu:gradle-aspectj:2.3.3'
    }
}

apply plugin: 'gradle-aspectj'
// rest of your code
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
       classpath 'io.github.zebalu:gradle-aspectj:2.3.3'
    }
}

apply plugin: 'gradle-aspectj'
// rest of your code