You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/maven.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,12 +182,10 @@ making sure that the `kotlin` plugin comes before the `maven-compiler-plugin` in
182
182
<artifactId>maven-compiler-plugin</artifactId>
183
183
<version>3.5.1</version>
184
184
<executions>
185
-
<!-- Replacing default-compile as it is treated specially by Maven -->
186
185
<execution>
187
186
<id>default-compile</id>
188
187
<phase>none</phase>
189
188
</execution>
190
-
<!-- Replacing default-testCompile as it is treated specially by Maven -->
191
189
<execution>
192
190
<id>default-testCompile</id>
193
191
<phase>none</phase>
@@ -212,6 +210,29 @@ making sure that the `kotlin` plugin comes before the `maven-compiler-plugin` in
212
210
</build>
213
211
```
214
212
213
+
There are a couple of notes to make here. First, since Maven 3.0.3, the plugins that bound to the same phase have specific execution order.
214
+
In particular, if plugin `A` is bind to phase `compile` and plugin `B` is bind to phase `compile`, then whoever is executed first is resolved by
215
+
their declaration order in the `pom.xml`. It simply means if `A` is declared before `B` in `pom.xml`, the `A` will be executed prior to `B`. However,
216
+
the built-in plugins native executions, like for plugins `maven-compiler-plugin`, `maven-jar-plugin` e.t.c are executed first regardless of their
217
+
order in `pom.xml`. Their execution ids are typically named `default-_someting_`.
218
+
219
+
Therefore, by specifying the following execution for `maven-compiler-plugin`:
220
+
221
+
```
222
+
<execution>
223
+
<id>default-compile</id>
224
+
<phase>none</phase>
225
+
</execution>
226
+
<execution>
227
+
<id>default-testCompile</id>
228
+
<phase>none</phase>
229
+
</execution>
230
+
```
231
+
232
+
we're effectively disabling the default executions of `maven-compiler-plugin`. Please, note, that usage of phase 'none' is just a well-known workaround for
233
+
disabling the particualr execution of plugin in Maven. By disabling `default-compile` and `default-testCompile` executions, the new executions `java-compile`
234
+
and not treated as predefined, therefore, and hence the `kotlin-maven-plugin`, as it is declared first, takes precedence.
235
+
215
236
## Enable incremental compilation
216
237
217
238
To make your builds faster, you can enable incremental compilation by adding the `kotlin.compiler.incremental` property:
0 commit comments