Skip to content

Commit

Permalink
4.x: backport native-image fixes + support -Dnative.image.skip and -D…
Browse files Browse the repository at this point in the history
…native.image.buildStatic (#7972)

Signed-off-by: tvallin <[email protected]>
Co-authored-by: Romain Grecourt <[email protected]>
  • Loading branch information
tvallin and romain-grecourt authored Nov 9, 2023
1 parent 93d7f26 commit 50dec45
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
2 changes: 0 additions & 2 deletions applications/mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@
<goals>
<goal>generateResourceConfig</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>build-native-image</id>
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Expand Down
54 changes: 54 additions & 0 deletions applications/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@
<executions>
<execution>
<id>resource-config</id>
<phase>package</phase>
<configuration>
<!-- generate records for all module's resources -->
<isDetectionEnabled>true</isDetectionEnabled>
</configuration>
</execution>
<execution>
<id>build-native-image</id>
<phase>package</phase>
<configuration>
<!-- generate an argument file for native image - great for troubleshooting -->
<useArgFile>true</useArgFile>
Expand All @@ -214,6 +216,58 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>native-image-skip</id>
<activation>
<property>
<name>native.image.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>resource-config</id>
<phase>none</phase>
</execution>
<execution>
<id>build-native-image</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>native-image-static</id>
<activation>
<property>
<name>native.image.buildStatic</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>build-native-image</id>
<configuration>
<buildArgs combine.children="append">
<arg>--static</arg>
</buildArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>helidon-cli</id>
<activation>
Expand Down
2 changes: 0 additions & 2 deletions applications/se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@
<goals>
<goal>generateResourceConfig</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>build-native-image</id>
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn clean package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

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

0 comments on commit 50dec45

Please sign in to comment.