From be6c5e3260af1eaf9ef1288acb17b9a04f9500c3 Mon Sep 17 00:00:00 2001 From: Vaclav Haisman Date: Tue, 28 Jul 2026 21:00:56 +0200 Subject: [PATCH 1/2] [MCOMPILER-569] Document implicitly compiled excluded sources Clarify that excluded sources may still be compiled implicitly and link the compile and testCompile exclusion parameters to the implicit option. Fixes https://github.com/apache/maven-compiler-plugin/issues/778 --- .../java/org/apache/maven/plugin/compiler/CompilerMojo.java | 4 ++++ .../org/apache/maven/plugin/compiler/TestCompilerMojo.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java index 0638d2991..39253c66c 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java @@ -109,6 +109,10 @@ public class CompilerMojo extends AbstractCompilerMojo { /** * A list of exclusion filters for the compiler. + * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, + * even if it has been excluded. + * + * @see AbstractCompilerMojo#implicit */ @Parameter private Set excludes = new HashSet<>(); 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 1e0b76ea8..0f9c91fc2 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java @@ -96,6 +96,10 @@ public class TestCompilerMojo extends AbstractCompilerMojo { /** * A list of exclusion filters for the compiler. + * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, + * even if it has been excluded. + * + * @see AbstractCompilerMojo#implicit */ @Parameter private Set testExcludes = new HashSet<>(); From 8410d33527602b92c9903997f8b5cc6fedd6d474 Mon Sep 17 00:00:00 2001 From: Vaclav Haisman Date: Tue, 28 Jul 2026 22:56:37 +0200 Subject: [PATCH 2/2] [MCOMPILER-569] Clarify excluded source documentation Explain that exclusions only affect sources passed explicitly by the plugin and that javac can still discover sources through the source path. --- .../java/org/apache/maven/plugin/compiler/CompilerMojo.java | 5 +++-- .../org/apache/maven/plugin/compiler/TestCompilerMojo.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java index 39253c66c..8fc63c598 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java @@ -109,8 +109,9 @@ public class CompilerMojo extends AbstractCompilerMojo { /** * A list of exclusion filters for the compiler. - * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, - * even if it has been excluded. + * Excluding a source file only prevents the plugin from passing it explicitly to the compiler. + * The compiler may still find it on the source path and generate a class file for it. + * This can happen with {@code module-info.java}. * * @see AbstractCompilerMojo#implicit */ 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 0f9c91fc2..e4058f1f5 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java @@ -96,8 +96,9 @@ public class TestCompilerMojo extends AbstractCompilerMojo { /** * A list of exclusion filters for the compiler. - * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, - * even if it has been excluded. + * Excluding a source file only prevents the plugin from passing it explicitly to the compiler. + * The compiler may still find it on the source path and generate a class file for it. + * This can happen with {@code module-info.java}. * * @see AbstractCompilerMojo#implicit */