Skip to content

Commit 780ebd5

Browse files
committed
[MCOMPILER-540] - useIncrementalCompilation=false may add generated sources to the sources list
1 parent 22ec826 commit 780ebd5

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
@@ -969,6 +969,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
969969
return;
970970
}
971971

972+
staleSources = filterSourceFiles(staleSources);
972973
compilerConfiguration.setSourceFiles(staleSources);
973974

974975
try {
@@ -1854,6 +1855,17 @@ public void setRelease(String release) {
18541855
targetOrReleaseSet = true;
18551856
}
18561857

1858+
private Set<File> filterSourceFiles(Set<File> sourceFiles) {
1859+
final File generatedSources = getGeneratedSourcesDirectory();
1860+
if (generatedSources == null) {
1861+
return sourceFiles;
1862+
}
1863+
final String generatedSourcesPath = generatedSources.getAbsolutePath();
1864+
return sourceFiles.stream()
1865+
.filter(x -> !x.getAbsolutePath().startsWith(generatedSourcesPath))
1866+
.collect(Collectors.toSet());
1867+
}
1868+
18571869
final String getImplicit() {
18581870
return implicit;
18591871
}

0 commit comments

Comments
 (0)