Skip to content

Commit d63feea

Browse files
committed
[MCOMPILER-540] - useIncrementalCompilation=false may add generated sources to the sources list
1 parent 3ea742c commit d63feea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

+12
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
940940
return;
941941
}
942942

943+
staleSources = filterSourceFiles(staleSources);
943944
compilerConfiguration.setSourceFiles(staleSources);
944945

945946
try {
@@ -1793,6 +1794,17 @@ public void setRelease(String release) {
17931794
targetOrReleaseSet = true;
17941795
}
17951796

1797+
private Set<File> filterSourceFiles(Set<File> sourceFiles) {
1798+
final File generatedSources = getGeneratedSourcesDirectory();
1799+
if (generatedSources == null) {
1800+
return sourceFiles;
1801+
}
1802+
final String generatedSourcesPath = generatedSources.getAbsolutePath();
1803+
return sourceFiles.stream()
1804+
.filter(x -> !x.getAbsolutePath().startsWith(generatedSourcesPath))
1805+
.collect(Collectors.toSet());
1806+
}
1807+
17961808
final String getImplicit() {
17971809
return implicit;
17981810
}

0 commit comments

Comments
 (0)