Skip to content

Commit 50dec45

Browse files
4.x: backport native-image fixes + support -Dnative.image.skip and -Dnative.image.buildStatic (#7972)
Signed-off-by: tvallin <[email protected]> Co-authored-by: Romain Grecourt <[email protected]>
1 parent 93d7f26 commit 50dec45

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

applications/mp/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,12 @@
7777
<goals>
7878
<goal>generateResourceConfig</goal>
7979
</goals>
80-
<phase>package</phase>
8180
</execution>
8281
<execution>
8382
<id>build-native-image</id>
8483
<goals>
8584
<goal>compile</goal>
8685
</goals>
87-
<phase>package</phase>
8886
</execution>
8987
</executions>
9088
</plugin>

applications/parent/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,15 @@
184184
<executions>
185185
<execution>
186186
<id>resource-config</id>
187+
<phase>package</phase>
187188
<configuration>
188189
<!-- generate records for all module's resources -->
189190
<isDetectionEnabled>true</isDetectionEnabled>
190191
</configuration>
191192
</execution>
192193
<execution>
193194
<id>build-native-image</id>
195+
<phase>package</phase>
194196
<configuration>
195197
<!-- generate an argument file for native image - great for troubleshooting -->
196198
<useArgFile>true</useArgFile>
@@ -214,6 +216,58 @@
214216
</pluginManagement>
215217
</build>
216218
<profiles>
219+
<profile>
220+
<id>native-image-skip</id>
221+
<activation>
222+
<property>
223+
<name>native.image.skip</name>
224+
</property>
225+
</activation>
226+
<build>
227+
<plugins>
228+
<plugin>
229+
<groupId>org.graalvm.buildtools</groupId>
230+
<artifactId>native-maven-plugin</artifactId>
231+
<executions>
232+
<execution>
233+
<id>resource-config</id>
234+
<phase>none</phase>
235+
</execution>
236+
<execution>
237+
<id>build-native-image</id>
238+
<phase>none</phase>
239+
</execution>
240+
</executions>
241+
</plugin>
242+
</plugins>
243+
</build>
244+
</profile>
245+
<profile>
246+
<id>native-image-static</id>
247+
<activation>
248+
<property>
249+
<name>native.image.buildStatic</name>
250+
</property>
251+
</activation>
252+
<build>
253+
<plugins>
254+
<plugin>
255+
<groupId>org.graalvm.buildtools</groupId>
256+
<artifactId>native-maven-plugin</artifactId>
257+
<executions>
258+
<execution>
259+
<id>build-native-image</id>
260+
<configuration>
261+
<buildArgs combine.children="append">
262+
<arg>--static</arg>
263+
</buildArgs>
264+
</configuration>
265+
</execution>
266+
</executions>
267+
</plugin>
268+
</plugins>
269+
</build>
270+
</profile>
217271
<profile>
218272
<id>helidon-cli</id>
219273
<activation>

applications/se/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,12 @@
6666
<goals>
6767
<goal>generateResourceConfig</goal>
6868
</goals>
69-
<phase>package</phase>
7069
</execution>
7170
<execution>
7271
<id>build-native-image</id>
7372
<goals>
7473
<goal>compile</goal>
7574
</goals>
76-
<phase>package</phase>
7775
</execution>
7876
</executions>
7977
</plugin>

examples/quickstarts/helidon-quickstart-se/Dockerfile.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ WORKDIR /helidon
3333
# Incremental docker builds will always resume after that, unless you update
3434
# the pom
3535
ADD pom.xml .
36-
RUN mvn clean package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
36+
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
3737

3838
# Do the Maven build!
3939
# Incremental docker builds will resume here when you change sources

0 commit comments

Comments
 (0)