Skip to content

Commit 4458921

Browse files
committed
[MCOMPILER-540] - useIncrementalCompilation=false may add generated sources to the sources list
1 parent 373f359 commit 4458921

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
@@ -990,6 +990,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
990990
return;
991991
}
992992

993+
staleSources = filterSourceFiles(staleSources);
993994
compilerConfiguration.setSourceFiles(staleSources);
994995

995996
try {
@@ -1875,6 +1876,17 @@ public void setRelease(String release) {
18751876
targetOrReleaseSet = true;
18761877
}
18771878

1879+
private Set<File> filterSourceFiles(Set<File> sourceFiles) {
1880+
final File generatedSources = getGeneratedSourcesDirectory();
1881+
if (generatedSources == null) {
1882+
return sourceFiles;
1883+
}
1884+
final String generatedSourcesPath = generatedSources.getAbsolutePath();
1885+
return sourceFiles.stream()
1886+
.filter(x -> !x.getAbsolutePath().startsWith(generatedSourcesPath))
1887+
.collect(Collectors.toSet());
1888+
}
1889+
18781890
final String getImplicit() {
18791891
return implicit;
18801892
}

0 commit comments

Comments
 (0)