E.g. try with start.spring.io:
$ mvn spring-boot:build-image
...
[INFO] Reactor Summary for start.spring.io 0.0.1-SNAPSHOT:
[INFO]
[INFO] start.spring.io .................................... SUCCESS [ 0.354 s]
[INFO] start.spring.io client ............................. FAILURE [01:05 min]
[INFO] start.spring.io website ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:06 min
[INFO] Finished at: 2020-05-29T16:57:49+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.RELEASE:build-image (default-cli) on project start-client: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.RELEASE:build-image failed: Unable to find main class -> [Help 1]
...
It's trying to build an image for the start-client project which isn't an app. Maybe the plugin should only try to build an image for a project that has the Spring Boot Maven Plugin configured by default, or something?
Comment From: snicoll
There is nothing we can do about that. You are asking maven to run a specific goal on the reactor and it does exactly that.
Maybe the plugin should only try to build an image for a project that has the Spring Boot Maven Plugin configured by default, or something?
That's what executions are for. You can enable the execution of such goal and use a regular phase (i.e. package).
Comment From: philwebb
@snicoll Can't we have some kind of intelligent 'enabled' property that does as Dave suggests? It feels a bit nasty that users can't just run spring-boot:build-image.
Comment From: philwebb
We just double checked things again and I was getting a little confused. I thought that the build-image goal required a repackaged jar but it actually doesn't so we shouldn't make the skipping too intelligent.
So for the original example, if you run mvn spring-boot:build-image from the root of the project you're asking the build-image goal to run on all of the children. It then fails for start-client because it's impossible to build an image for that module.
If you really want to be able to run the build-image goal from the root you'd have to update start-client with something like following:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>skip-build-image</id>
<goals>
<goal>build-mage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
You might also be able to use a spring-boot.build-image.skip property (but I'm not totally sure about that).
For the start.spring.io project, it's probably best to execute the goal only on the single project:
mvn spring-boot:build-image -pl start-site
Comment From: philwebb
Another option might be to configure the start-site module to bind the build-image goal to a maven lifecycle element such as package.