Skip to content

Instantly share code, notes, and snippets.

@arleighdickerson
Last active July 26, 2022 16:34
Show Gist options
  • Save arleighdickerson/951993e0867d0d65c6a046cd42dc6153 to your computer and use it in GitHub Desktop.
Save arleighdickerson/951993e0867d0d65c6a046cd42dc6153 to your computer and use it in GitHub Desktop.
plugins {
id 'org.springframework.boot'
id 'io.spring.dependency-management'
id 'java'
id 'idea'
id 'io.freefair.lombok' version "${freefairPluginVersion}" // 6.0.0-m2
}
configurations {
rt
ajc
inpath
aspectpath
compile {
exclude module: 'spring-boot-starter-tomcat'
}
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
compileJava {
actions = []
dependsOn {
configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileJava")
delombok
}
source = delombok
doLast {
ant.taskdef(
resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
classpath: configurations.ajc.asPath
)
ant.iajc(
source: project.sourceCompatibility,
target: project.targetCompatibility,
maxmem: "512m",
fork: "true",
destDir: "${project.buildDir}/classes/java/main",
sourceroots: "${project.buildDir}/generated/sources/delombok/java/main",
aspectPath: configurations.aspectpath.asPath,
Xlint: "ignore",
inpath: configurations.inpath.asPath,
classpath: "${configurations.compileOnly.asPath};${configurations.runtimeClasspath.asPath};${configurations.rt.asPath}",
)
}
}
dependencies {
// ajc inputs
inpath 'org.springframework:spring-aspects'
aspectpath project(':my-aspects')
// ajc dependencies
ajc "org.aspectj:aspectjtools:${rootProject.ext.aspectjVersion}" // 1.9.6
compileClasspath "org.aspectj:aspectjweaver:${rootProject.ext.aspectjVersion}"
runtimeClasspath "org.aspectj:aspectjrt:${rootProject.ext.aspectjVersion}"
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment