jib icon indicating copy to clipboard operation
jib copied to clipboard

JIB Maven plugin fails when a module contains no files

Open TigerLilly64 opened this issue 3 months ago • 4 comments

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.

TigerLilly64 avatar Sep 03 '25 13:09 TigerLilly64

Added log file of the failing job:

logs_44709576006.zip

TigerLilly64 avatar Sep 03 '25 13:09 TigerLilly64

Hi @TigerLilly64, thanks for reporting this issue.

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).

Would you mind sharing a snippet or other resource to demonstrate how this is reproduced?

diegomarquezp avatar Sep 08 '25 20:09 diegomarquezp

Additionally to get you unblocked, can you include a fake java file in the module to work around this issue?

mpeddada1 avatar Sep 12 '25 13:09 mpeddada1

Yes. It is not a big issue. As soon as you add an empty class, the problem no longer shows.

Sent from Proton Mail Android

-------- Original Message -------- On 12/09/2025 15:48, Mridula wrote:

mpeddada1 left a comment (GoogleContainerTools/jib#4411)

Additionally to get you unblocked, can you include a fake java file in the module to work around this issue?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

TigerLilly64 avatar Sep 12 '25 13:09 TigerLilly64