Skip to content

Commit b7bbb90

Browse files
committed
Publishing documentation for version 1.1.5
1 parent 6a22c6d commit b7bbb90

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

1.1.5/maven-plugin.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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">&lt;plugin&gt;
930+
&lt;groupId&gt;org.graalvm.buildtools&lt;/groupId&gt;
931+
&lt;artifactId&gt;native-maven-plugin&lt;/artifactId&gt;
932+
&lt;executions&gt;
933+
&lt;execution&gt;
934+
&lt;id&gt;build-native&lt;/id&gt;
935+
&lt;phase&gt;package&lt;/phase&gt;
936+
&lt;goals&gt;
937+
&lt;goal&gt;generateResourceConfig&lt;/goal&gt;
938+
&lt;goal&gt;compile-no-fork&lt;/goal&gt;
939+
&lt;/goals&gt;
940+
&lt;/execution&gt;
941+
&lt;/executions&gt;
942+
&lt;configuration&gt;
943+
&lt;resourceIncludedPatterns&gt;
944+
&lt;pattern&gt;application.properties&lt;/pattern&gt;
945+
&lt;/resourceIncludedPatterns&gt;
946+
&lt;/configuration&gt;
947+
&lt;/plugin&gt;</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

Comments
 (0)