Skip to content

Commit

Permalink
support -Dnative.image.skip and -Dnative.image.buildStatic (helidon-i…
Browse files Browse the repository at this point in the history
…o#6438)

* Update application parent poms to support -Dnative.image.skip and -Dnative.image.buildStatic
This makes the Dockerfiles backward compatible.

Fixes helidon-io#6307
Fixes helidon-io#6283

* Move native goals out of pluginManagement as they get included with any declaration of the native-image plugin.
  • Loading branch information
romain-grecourt authored Mar 21, 2023
1 parent 7fce9f8 commit e42f565
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 22 deletions.
2 changes: 0 additions & 2 deletions applications/mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,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
36 changes: 32 additions & 4 deletions applications/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,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 @@ -210,11 +212,37 @@
</build>
<profiles>
<profile>
<id>linux-native</id>
<id>native-image-skip</id>
<activation>
<os>
<family>Linux</family>
</os>
<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>
Expand Down
2 changes: 0 additions & 2 deletions applications/se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,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 @@ -21,12 +21,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/integrations/neo4j/neo4j-mp/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/integrations/neo4j/neo4j-se/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-mp/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-se/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -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
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down

0 comments on commit e42f565

Please sign in to comment.