-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
I ran into a minor issue when trying to build a docker image using JIB.
When building a multi-module application, the build fails when there is one or more modules that only exist as a structure (i.e. the contain no files, but the default directory structure for maven is present).
I receive the following error message:
[INFO] Building jar: /home/runner/work/user-registration/user-registration/200-logic/210-services/target/spring-demo-services-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- jib:3.4.0:build (default-cli) @ spring-demo-services ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for user-registration 0.0.1-SNAPSHOT:
[INFO]
[INFO] user-registration .................................. SUCCESS [ 39.727 s]
[INFO] spring-demo-db ..................................... SUCCESS [ 7.591 s]
[INFO] spring-demo-entities ............................... SUCCESS [ 16.996 s]
[INFO] spring-demo-logic .................................. SUCCESS [ 0.024 s]
[INFO] spring-demo-services ............................... FAILURE [ 0.052 s]
[INFO] spring-demo-controllers ............................ SKIPPED
[INFO] spring-demo-application ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:18 min
[INFO] Finished at: 2025-09-03T12:28:48Z
[INFO] ------------------------------------------------------------------------
Error: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.0:build (default-cli) on project spring-demo-services: Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean compile jib:build"?): /home/runner/work/user-registration/user-registration/200-logic/210-services/target/classes -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error:
Error: After correcting the problems, you can resume the build with the command
Error: mvn -rf :spring-demo-services
Error: Process completed with exit code 1
Is this a bug, or intentional. Once i added a class in the failing modules, it worked as expected.