Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
Expand All @@ -41,6 +42,7 @@
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.handler.ArtifactHandler;
Expand Down Expand Up @@ -1173,6 +1175,17 @@ public void execute() throws MojoExecutionException, CompilationFailureException
if (useIncrementalCompilation) {
incrementalBuildHelperRequest.outputDirectory(getOutputDirectory());

// Cleanup the generated source files created by annotation processing
// they are regenerated by the java compiler.
if (getGeneratedSourcesDirectory() != null) {
try (Stream<Path> walk =
Files.walk(getGeneratedSourcesDirectory().toPath())) {
walk.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
} catch (IOException ex) {
getLog().warn("I/O error deleting the annotation processing generated files: " + ex.getMessage());
}
}

incrementalBuildHelper.beforeRebuildExecution(incrementalBuildHelperRequest);

getLog().debug("incrementalBuildHelper#beforeRebuildExecution");
Expand Down