@@ -477,6 +477,7 @@ <h1>Maven plugin for GraalVM Native Image</h1>
477477< li > < a href ="#native-image-options "> Native Image Options</ a > </ li >
478478</ ul >
479479</ li >
480+ < li > < a href ="#resources "> Resources</ a > </ li >
480481< li > < a href ="#native-image-tracing-agent "> Native Image Tracing Agent</ a >
481482< ul class ="sectlevel2 ">
482483< li > < a href ="#agent-support-enabling "> Enabling the Agent</ a > </ li >
@@ -916,6 +917,54 @@ <h3 id="native-image-options"><a class="anchor" href="#native-image-options"></a
916917</ div >
917918</ div >
918919< div class ="sect1 ">
920+ < h2 id ="resources "> < a class ="anchor " href ="#resources "> </ a > Resources</ h2 >
921+ < div class ="sectionbody ">
922+ < div class ="paragraph ">
923+ < p > To include classpath resources in a native image, configure resource patterns and run
924+ < code > generateResourceConfig</ code > before the native build goal. For example, the following execution
925+ includes < code > application.properties</ code > and creates the native image during the < code > package</ code > phase:</ p >
926+ </ div >
927+ < div class ="listingblock multi-language-sample ">
928+ < div class ="content ">
929+ < pre class ="highlightjs highlight "> < code class ="language-xml hljs " data-lang ="xml "> <plugin>
930+ <groupId>org.graalvm.buildtools</groupId>
931+ <artifactId>native-maven-plugin</artifactId>
932+ <executions>
933+ <execution>
934+ <id>build-native</id>
935+ <phase>package</phase>
936+ <goals>
937+ <goal>generateResourceConfig</goal>
938+ <goal>compile-no-fork</goal>
939+ </goals>
940+ </execution>
941+ </executions>
942+ <configuration>
943+ <resourceIncludedPatterns>
944+ <pattern>application.properties</pattern>
945+ </resourceIncludedPatterns>
946+ </configuration>
947+ </plugin></ code > </ pre >
948+ </ div >
949+ </ div >
950+ < div class ="paragraph ">
951+ < p > < code > generateResourceConfig</ code > writes the configuration to
952+ < em > target/native/generated/generateResourceConfig/resource-config.json</ em > . The following
953+ < code > compile-no-fork</ code > goal automatically consumes that generated configuration when it builds the
954+ native image.</ p >
955+ </ div >
956+ < div class ="paragraph ">
957+ < p > To detect resources automatically instead of listing patterns, enable autodetection when running
958+ the same execution:</ p >
959+ </ div >
960+ < div class ="listingblock multi-language-sample ">
961+ < div class ="content ">
962+ < pre class ="highlightjs highlight "> < code class ="language-bash hljs " data-lang ="bash "> ./mvnw -Pnative -Dresources.autodetection.enabled=true package</ code > </ pre >
963+ </ div >
964+ </ div >
965+ </ div >
966+ </ div >
967+ < div class ="sect1 ">
919968< h2 id ="native-image-tracing-agent "> < a class ="anchor " href ="#native-image-tracing-agent "> </ a > Native Image Tracing Agent</ h2 >
920969< div class ="sectionbody ">
921970< div class ="paragraph ">
0 commit comments