Skip to content

Commit 4a8258f

Browse files
committed
GH-1255 - Fix path handling for KAPT usage with Maven.
In our KAPT support, the base folder detection now also accommodates Maven usage by looking for its default generated sources output path.
1 parent c0b1e97 commit 4a8258f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-modulith-apt/src/main/java/org/springframework/modulith/apt/SpringModulithProcessor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,12 @@ private static Path getAptOutputFolder(ProcessingEnvironment environment) {
319319
var kapt = environment.getOptions().get("kapt.kotlin.generated");
320320

321321
if (kapt != null) {
322-
return Path.of(kapt.substring(0, kapt.indexOf("/build/generated/source")));
322+
323+
// Strip Gradle or Maven suffixes
324+
var index = kapt.indexOf("/build/generated/source");
325+
index = index == -1 ? kapt.indexOf("/target/generated-sources") : index;
326+
327+
return Path.of(kapt.substring(0, index));
323328
}
324329

325330
return Path.of(".");

0 commit comments

Comments
 (0)