Skip to content

Commit be18137

Browse files
Suport command line paramenters for incremental build (#958)
1 parent 061a754 commit be18137

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ final Charset charset() {
623623
* @see #createMissingPackageInfoClass
624624
* @since 4.0.0
625625
*/
626-
@Parameter // The default values are implemented in `incrementalCompilationConfiguration()`.
626+
@Parameter(property = "maven.compiler.incrementalCompilation")
627627
protected String incrementalCompilation;
628628

629629
/**
@@ -679,7 +679,7 @@ final EnumSet<IncrementalBuild.Aspect> incrementalCompilationConfiguration() {
679679
* @see #incrementalCompilation
680680
* @since 3.1
681681
*/
682-
@Parameter
682+
@Parameter(defaultValue = "class,jar")
683683
protected List<String> fileExtensions;
684684

685685
/**
@@ -1074,19 +1074,18 @@ String moduleOfPreviousExecution() throws IOException {
10741074
* @throws IOException if this method needed to read a module descriptor and failed
10751075
*/
10761076
boolean hasModuleDeclaration(final List<SourceDirectory> roots) throws IOException {
1077-
switch (project.getPackaging().type().id()) {
1078-
case Type.CLASSPATH_JAR:
1079-
return false;
1080-
case Type.MODULAR_JAR:
1081-
return true;
1082-
default:
1077+
return switch (project.getPackaging().type().id()) {
1078+
case Type.CLASSPATH_JAR -> false;
1079+
case Type.MODULAR_JAR -> true;
1080+
default -> {
10831081
for (SourceDirectory root : roots) {
10841082
if (root.getModuleInfo().isPresent()) {
1085-
return true;
1083+
yield true;
10861084
}
10871085
}
1088-
return false;
1089-
}
1086+
yield false;
1087+
}
1088+
};
10901089
}
10911090

10921091
/**

src/main/java/org/apache/maven/plugin/compiler/ToolExecutor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ public boolean applyIncrementalBuild(final AbstractCompilerMojo mojo, final Opti
323323
}
324324
if (checkDepends && causeOfRebuild == null) {
325325
List<String> fileExtensions = mojo.fileExtensions;
326-
if (fileExtensions == null || fileExtensions.isEmpty()) {
327-
fileExtensions = List.of("class", "jar");
328-
}
329326
causeOfRebuild = incrementalBuild.dependencyChanges(dependencies.values(), fileExtensions);
330327
}
331328
if (checkOptions && causeOfRebuild == null) {

0 commit comments

Comments
 (0)