AspectJ + Gradle configuration

后端 未结 6 497
执念已碎
执念已碎 2021-02-04 11:31

I\'d like to use AspectJ in Gradle project (it\'s not an Android project - just a simple Java app).

Here is how my build.gradle looks like:

apply plugin         


        
6条回答
  •  暖寄归人
    2021-02-04 12:28

    Adding this in my build.gradle file worked for me.

    project.ext {
      aspectjVersion = '1.8.12'
    }
    
    apply plugin: "aspectj.gradle"
    
    buildscript {
      repositories {
        maven {
          url "https://plugins.gradle.org/m2/"
        }
      }
      dependencies {
        classpath "gradle.plugin.aspectj:gradle-aspectj:0.1.6"
      }
    }
    

    Doing a gradle assemble injected the code defined in the aspect.

提交回复
热议问题