Skip to content

Commit 8983a34

Browse files
committed
Configure annotation processing in Java compilation
Add support for annotation processing options through the `ap` property in `gradle.properties`. These options are parsed and applied to the `compileJava` task, allowing for customizable compiler arguments.
1 parent 179e5fa commit 8983a34

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ configure(integrationTestProjects) {
246246
options.encoding = encoding
247247
}
248248

249+
compileJava {
250+
val ap: String by project
251+
ap.split(",").map { it.trim() }.filter { it.isNotEmpty() }.map { "-A$it" }.forEach {
252+
options.compilerArgs.add(it)
253+
}
254+
}
255+
249256
compileTestJava {
250257
options.compilerArgs.addAll(listOf("-proc:none"))
251258
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ sqlserver.url=jdbc:tc:sqlserver:2019-CU28-ubuntu-20.04:///test?TC_DAEMON=true
2525

2626
# javac or ecj
2727
compiler=javac
28+
# annotation processing options (CSV format)
29+
ap=

0 commit comments

Comments
 (0)