Browse Source

Document that native-maven-plugin is required for native images

Closes gh-33422
pull/33424/head
Moritz Halbritter 3 years ago
parent
commit
351084ea06
  1. 15
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/native-image/developing-your-first-application.adoc

15
spring-boot-project/spring-boot-docs/src/docs/asciidoc/native-image/developing-your-first-application.adoc

@ -53,7 +53,7 @@ On Microsoft Windows, make sure to enable the https://docs.docker.com/docker-for @@ -53,7 +53,7 @@ On Microsoft Windows, make sure to enable the https://docs.docker.com/docker-for
[[native-image.developing-your-first-application.buildpacks.maven]]
==== Using Maven
To build a native image container using Maven you should ensure that your `pom.xml` file uses the `spring-boot-starter-parent`.
To build a native image container using Maven you should ensure that your `pom.xml` file uses the `spring-boot-starter-parent` and the `org.graalvm.buildtools:native-maven-plugin`.
You should have a `<parent>` section that looks like this:
[source,xml,indent=0,subs="verbatim,attributes"]
@ -65,6 +65,16 @@ You should have a `<parent>` section that looks like this: @@ -65,6 +65,16 @@ You should have a `<parent>` section that looks like this:
</parent>
----
You additionally should have this in the `<build> <plugins>` section:
[source,xml,indent=0,subs="verbatim,attributes"]
----
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
----
The `spring-boot-starter-parent` declares a `native` profile that configures the executions that need to run in order to create a native image.
You can activate profiles using the `-P` flag on the command line.
@ -181,7 +191,8 @@ Due to the https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-ex @@ -181,7 +191,8 @@ Due to the https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-ex
[[native-image.developing-your-first-application.native-build-tools.maven]]
==== Using Maven
As with the <<native-image#native-image.developing-your-first-application.buildpacks.maven, buildpack support>>, you need to make sure that you're using `spring-boot-starter-parent` in order to inherit the `native` profile.
As with the <<native-image#native-image.developing-your-first-application.buildpacks.maven, buildpack support>>, you need to make sure that you're using `spring-boot-starter-parent` in order to inherit the `native` profile and that the `org.graalvm.buildtools:native-maven-plugin` plugin is used.
With the `native` profile active, you can invoke the `native:compile` goal to trigger `native-image` compilation:

Loading…
Cancel
Save