question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`spring-boot:build-image` hangs on multi-module project

See original GitHub issue

Running mvn spring-boot:build-image at the root of a multi-module maven project hangs forever.

Sample project there: git@github.com:ch4mpy/lifix.git

Last logs output:

[INFO] --- spring-boot-maven-plugin:2.5.3:build-image (default-cli) @ common-storage ---
[INFO] Building image 'docker.io/library/common-storage:0.0.1-SNAPSHOT'
[INFO]
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder@sha256:4fae5e2abab118ca9a37bf94ab42aa17fef7c306296b0364f5a0e176702ab5cb'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:a285e73bc3697bc58c228b22938bc81e9b11700e087fd9d44da5f42f14861812'
[INFO]  > Executing lifecycle version v0.11.4
[INFO]  > Using build cache volume 'pack-cache-382e7345203f.build'
[INFO]
[INFO]  > Running creator

and then nothing for more than 1/2 hour.

I Also tried to run

  • mvn package -Pnative
  • mvn clean install and then mvn spring-boot:build-image -pl faults-endpoints (where faults-endpoints is a spring-boot app for which I’d like to have a native image).

Both of the later fail, but with following error message, which make me think it’s a distinct issue:

[INFO]     [creator]     Error: Error parsing dynamic proxy configuration in file:/workspace/META-INF/native-image/org.springframework.aot/spring-aot/proxy-config.json:
[INFO]     [creator]     java.lang.IllegalArgumentException: repeated interface: org.springframework.aop.SpringProxy
[INFO]     [creator]     Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option DynamicProxyConfigurationResources.
[INFO]     [creator]     Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[INFO]     [creator]     Error: Image build request failed with exit status 1
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to contribute native-image layer
[INFO]     [creator]     error running build
[INFO]     [creator]     exit status 1
[INFO]     [creator]     ERROR: failed to build: exit status 1

My point here is: shouldn’t mvn spring-boot:build-image at root of multi-module project ignore non-application modules ? (or at least exit with error message)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
sdeleuzecommented, Jul 28, 2021

Thanks @scottfrederick, I am closing this issue on Spring Native side since you have created one on Spring Boot side.

0reactions
scottfrederickcommented, Jul 28, 2021

Could we consider build-image as a sort of repackage?

@ch4mpy The repackage and build-image goals are configured in very much the same way. Both bind to the package phase by default, and the Spring Boot plugin must be activate for either to do anything. The only real difference is that repackage is activated by default when using spring-boot-starter-parent as a Maven parent project (as mentioned in the documentation), but build-image is not activated by default.

Ideally, I’d like to be able to run mvn package and get “fat-jars” for all modules with spring-boot-maven-plugin and also native image for those having both spring-boot-maven-plugin and spring-aot-maven-plugin

This means having spring-boot:build-image behave quite the same as spring-boot:repackage: hook on package target, just require an additional plugin to activate

You can get the outcome you’re describing by configuring your build as suggested above. Add spring-boot-maven-plugin to all modules so they get repackaged, and only add the build-image execution in modules that you want an OCI image for. You’ll need to do the appropriate configuration of spring-boot-maven-plugin in each module to make that work. The spring-boot-maven-plugin and spring-aot-maven-plugin do not and should not know about each other as they serve different purposes, so one plugin won’t influence the behavior of the other.

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring-boot fails on multi-module app - Stack Overflow
I used this to run single spring boot web app. Then I add there new parent pom and another module. And after that...
Read more >
Containerizing Maven/Gradle based Multi Module Spring Boot ...
A detailed step by step guide to Containerize Maven/Gradle based Multi Module Spring Boot Microservices using Docker & Kubernetes.
Read more >
Docker buildx hangs when building image for arm64 using ...
Coding example for the question Docker buildx hangs when building image for arm64 using multi-stage Java build-Springboot.
Read more >
Spring Native documentation
The easiest way to start a new native Spring Boot project is to go to ... in multi modules projects or when using...
Read more >
Developer Documentation
Single and Multi module projects ... Spring Boot Migrator (SBM) aims to help developers migrating applications to Spring Boot, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found