incrementalExcludes = new HashSet<>();
+
/**
*
* Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+
@@ -387,7 +394,7 @@ private List getCompileClasspathElements( MavenProject project )
protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
{
- if ( includes.isEmpty() && excludes.isEmpty() )
+ if ( includes.isEmpty() && excludes.isEmpty() && incrementalExcludes.isEmpty() )
{
return new StaleSourceScanner( staleMillis );
}
@@ -397,7 +404,9 @@ protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
includes.add( "**/*.java" );
}
- return new StaleSourceScanner( staleMillis, includes, excludes );
+ Set excludesIncr = new HashSet<>( excludes );
+ excludesIncr.addAll( this.incrementalExcludes );
+ return new StaleSourceScanner( staleMillis, includes, excludesIncr );
}
protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEnding )
@@ -409,8 +418,9 @@ protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEndi
{
includes.add( defaultIncludePattern );
}
-
- return new SimpleSourceInclusionScanner( includes, excludes );
+ Set excludesIncr = new HashSet<>( excludes );
+ excludesIncr.addAll( excludesIncr );
+ return new SimpleSourceInclusionScanner( includes, excludesIncr );
}
protected String getSource()
diff --git a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
index 43683040..ed855ab5 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
@@ -90,6 +90,13 @@ public class TestCompilerMojo
@Parameter
private Set testExcludes = new HashSet<>();
+ /**
+ * A list of exclusion filters for the incremental calculation.
+ * @since 3.11
+ */
+ @Parameter
+ private Set testIncrementalExcludes = new HashSet<>();
+
/**
* The -source argument for the test Java compiler.
*
@@ -414,7 +421,7 @@ protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
{
SourceInclusionScanner scanner;
- if ( testIncludes.isEmpty() && testExcludes.isEmpty() )
+ if ( testIncludes.isEmpty() && testExcludes.isEmpty() && testIncrementalExcludes.isEmpty() )
{
scanner = new StaleSourceScanner( staleMillis );
}
@@ -424,7 +431,9 @@ protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
{
testIncludes.add( "**/*.java" );
}
- scanner = new StaleSourceScanner( staleMillis, testIncludes, testExcludes );
+ Set excludesIncr = new HashSet<>( testExcludes );
+ excludesIncr.addAll( this.testIncrementalExcludes );
+ scanner = new StaleSourceScanner( staleMillis, testIncludes, excludesIncr );
}
return scanner;
@@ -437,7 +446,7 @@ protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEndi
// it's not defined if we get the ending with or without the dot '.'
String defaultIncludePattern = "**/*" + ( inputFileEnding.startsWith( "." ) ? "" : "." ) + inputFileEnding;
- if ( testIncludes.isEmpty() && testExcludes.isEmpty() )
+ if ( testIncludes.isEmpty() && testExcludes.isEmpty() && testIncrementalExcludes.isEmpty() )
{
testIncludes = Collections.singleton( defaultIncludePattern );
scanner = new SimpleSourceInclusionScanner( testIncludes, Collections.emptySet() );
@@ -448,7 +457,9 @@ protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEndi
{
testIncludes.add( defaultIncludePattern );
}
- scanner = new SimpleSourceInclusionScanner( testIncludes, testExcludes );
+ Set excludesIncr = new HashSet<>( testExcludes );
+ excludesIncr.addAll( this.testIncrementalExcludes );
+ scanner = new SimpleSourceInclusionScanner( testIncludes, excludesIncr );
}
return scanner;