This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new be18137 Suport command line paramenters for incremental build (#958)
be18137 is described below
commit be18137cc32002856745be14ddb2869dffa35f0a
Author: zhaoyunxing <[email protected]>
AuthorDate: Thu Sep 18 16:18:49 2025 +0800
Suport command line paramenters for incremental build (#958)
---
.../maven/plugin/compiler/AbstractCompilerMojo.java | 21 ++++++++++-----------
.../apache/maven/plugin/compiler/ToolExecutor.java | 3 ---
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git
a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index 57b3c61..c2f7a50 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -623,7 +623,7 @@ public abstract class AbstractCompilerMojo implements Mojo {
* @see #createMissingPackageInfoClass
* @since 4.0.0
*/
- @Parameter // The default values are implemented in
`incrementalCompilationConfiguration()`.
+ @Parameter(property = "maven.compiler.incrementalCompilation")
protected String incrementalCompilation;
/**
@@ -679,7 +679,7 @@ public abstract class AbstractCompilerMojo implements Mojo {
* @see #incrementalCompilation
* @since 3.1
*/
- @Parameter
+ @Parameter(defaultValue = "class,jar")
protected List<String> fileExtensions;
/**
@@ -1074,19 +1074,18 @@ public abstract class AbstractCompilerMojo implements
Mojo {
* @throws IOException if this method needed to read a module descriptor
and failed
*/
boolean hasModuleDeclaration(final List<SourceDirectory> roots) throws
IOException {
- switch (project.getPackaging().type().id()) {
- case Type.CLASSPATH_JAR:
- return false;
- case Type.MODULAR_JAR:
- return true;
- default:
+ return switch (project.getPackaging().type().id()) {
+ case Type.CLASSPATH_JAR -> false;
+ case Type.MODULAR_JAR -> true;
+ default -> {
for (SourceDirectory root : roots) {
if (root.getModuleInfo().isPresent()) {
- return true;
+ yield true;
}
}
- return false;
- }
+ yield false;
+ }
+ };
}
/**
diff --git a/src/main/java/org/apache/maven/plugin/compiler/ToolExecutor.java
b/src/main/java/org/apache/maven/plugin/compiler/ToolExecutor.java
index de7c3fb..4177459 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/ToolExecutor.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/ToolExecutor.java
@@ -323,9 +323,6 @@ public class ToolExecutor {
}
if (checkDepends && causeOfRebuild == null) {
List<String> fileExtensions = mojo.fileExtensions;
- if (fileExtensions == null || fileExtensions.isEmpty()) {
- fileExtensions = List.of("class", "jar");
- }
causeOfRebuild =
incrementalBuild.dependencyChanges(dependencies.values(), fileExtensions);
}
if (checkOptions && causeOfRebuild == null) {