Add support for building an image without forking the Maven lifecycle

This commit adds a new "build-image-no-fork" goal that behaves exactly
as "build-image", except it does not fork the lifecycle. This is a
common pattern in maven plugins where a goal can be invoked on the
command-line and conveniently make sure that a certain phase has run
prior to its execution.

The new goal is suitable for binding the goal in a phase, typically
package, and rely on it rather than invoking the goal. This makes sure
that the lifecycle is forked, which would run everything again.

Closes gh-26455
This commit is contained in:
Stephane Nicoll
2022-11-21 13:05:23 +01:00
parent efa8d8b877
commit a7f57091a6
29 changed files with 139 additions and 48 deletions

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -41,7 +41,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -35,7 +35,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -25,7 +25,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId>
<artifactId>build-image</artifactId>
<artifactId>build-image-cmd-line</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -11,19 +11,19 @@
<maven.compiler.target>@java.version@</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<image>
<builder>projects.registry.vmware.com/springboot/spring-boot-cnb-builder:0.0.1</builder>
</image>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -20,7 +20,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<finalName>final-name</finalName>

View File

@@ -27,7 +27,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -20,7 +20,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -25,7 +25,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>

View File

@@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>