Skip to content

Commit b0aba82

Browse files
committed
Allow to enable the native profile via Maven property
In some cases it could be desired to enable the `native` profile directly from Maven, so that the caller of Maven does not need to call Maven with `-Pnative`. To enable this behavior, I added an activation section to the generated POM with the profile definition.
1 parent 71f509c commit b0aba82

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/native-image/developing-your-first-application.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ With the `native` profile active, you can invoke the `native:compile` goal to tr
210210
$ mvn -Pnative native:compile
211211
----
212212

213+
The `native` profile can be activated by default by setting the Maven property `native` to `true` in the POM.
214+
215+
[source,xml]
216+
----
217+
<properties>
218+
<native>true</native>
219+
</properties>
220+
----
221+
213222
The native image executable can be found in the `target` directory.
214223

215224

spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ publishing.publications.withType(MavenPublication) {
248248
profiles {
249249
profile {
250250
delegate.id("native")
251+
activation {
252+
property {
253+
delegate.name('native')
254+
delegate.value('true')
255+
}
256+
}
251257
build {
252258
pluginManagement {
253259
plugins {

0 commit comments

Comments
 (0)