Skip to content

Conversation

@dsyer
Copy link
Member

@dsyer dsyer commented Jul 31, 2020

The build-image Mojo doesn't attempt to re-use an existing
JAR file that it has already built. This is a small change
that just checks if it already exists and re-uses it.

A side effect is that other plugins can modify the JAR file
(e.g. to optimize the reflection usage for a native-image
build) and those changes are visible in the container
image.

Possibly something similar can be done in the Gradle
plugin?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 31, 2020
@wilkinsona
Copy link
Member

Possibly something similar can be done in the Gradle plugin?

By default, the Gradle plugin already uses the output of the BootJar task when creating the image. It should be possible to use a dependency substitution to swap in the optimised Tomcat dependency.

@wilkinsona wilkinsona added the for: team-attention An issue we'd like other members of the team to review label Jul 31, 2020
The build-image Mojo doesn't attempt to re-use an existing
JAR file that it has already built. This is a small change
that just checks if it already exists and re-uses it.

A side effect is that other plugins can modify the JAR file
(e.g. to optimize the reflection usage for a native-image
build) and those changes are visible in the container
image.
@philwebb
Copy link
Member

Unfortunately, I'm not convinced that this change will always work. There's some logic in ImagePackager.packageImage that ensures the non-repackaged source is always used. With the suggested change, we lose control over what actually gets uploaded and if the user hasn't created a fat jar, the OCI image will break. We also faced problems with Gradle when uploading packaged jars that include a launch script in the front.

I think if other optimizations are needed, we should look at some kind of dedicated API hook.

@philwebb philwebb closed this Jul 31, 2020
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants