containerizingMode = 'packaged' does not work with Spring Boot in Gradle
See original GitHub issueHi there!
We build our SpringBoot application with a BootJar
task (which inherits from Jar
) in Graddle, and the new containerizingMode = 'packaged'
feature hard-codes the task name to jar
:
Would it possible to have this name configurable?
Like:
jib {
jarTaskName = 'bootJar'
}
(or pass the task object directly, or even explicitly the path to the jar file)
I have currently worked around that by pointing the attributes of jar
to bootjar
:
jar {
enabled = false
destinationDir = tasks.bootJar.getDestinationDir()
archiveName = tasks.bootJar.getArchiveName()
}
I guess another alternative could be (not tested and I’d like not to have to rename my bootJar
task):
task jar(type: BootJar) {
...
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Build Spring Boot fat JAR using JIB - Stack Overflow
Yes, it is possible to put a fat jar on to the container image using Jib. Please use "containerizingMode" configuration option of Jib:...
Read more >google/jib - Gitter
I need to use <containerizingMode>packaged mode. But to generate the jar file I use proguard packager (not the normal maven jar packager), do...
Read more >Spring Boot Gradle Plugin Reference Guide
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle. It allows you to package executable jar or war archives, run Spring ......
Read more >Using Jib to containerize Java apps | Google Cloud Blog
For example, Jib's packaged containerizing-mode now works out of the box ... iteration of Maven and Gradle Jib extensions for Spring Boot, ...
Read more >Jib 2.0.0 has been released - Google Groups
containerizingMode ='packaged'/<containerizingMode>packaged works as intended with Spring Boot projects that generate a fat JAR.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@maxbrunet We’ve released 2.0.0, which contains this fix!
@maxbrunet so the best workaround for you should be to enable the
jar
task to generate a normal (non-fat) JAR. The Spring Boot reference saysso enabling the
jar
task is clearly supported by Spring Boot.But then
jar
andbootJar
will write their respective JAR to the same location, so you’ll need to give a classifier to either one. For example,or
Then Jib will make use of the normal JAR instead of the fat JAR. This will let you avoid duplicating dependencies packaged in the fat JAR. Also this does not require you to manually override the entrypoint to something like
java -jar
.