-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.0.0 jib-maven-plugin breaking changes when using packaged containerizingMode. #2267
Comments
Hi, This is the intended change. Don't define your own |
but I need fat jar and custom entrypoint for debugging purposes. using java-debugg image is inconvenient in our case |
@daggerok could you explain more please? Also curious about where you're deploying to? We may be able to suggest alternatives to simplify your debugging requirements. |
Hello @briandealwis It's inconvenient because
jib is super nice and I like it a lot, but sometimes current opinionated way can be quite limited or even cannot be applied at all... this is where It would be good to have more control and this is why for few customers we are using non standard customised fat jar as well (and btw even jib fat jar is much more better than custom Dockerfile builds...) Regards, |
What's not clear to us is the requirement of a fat jar for debugging, perhaps we can solve this problem specifically: why do you need the fat jar to do the debugging? As for some other things:
|
Hello @loosebazooka Thanks for feedback, but as I can see reported issue discussion is going in some wrong direction, related to debugging purposes, which was mention by me as first point goes in my mind, not as main reason why I need this configuration. Anyway, in my first post I have provided example, which is working on 1.7.0 and 1.8.0, but doesn't work on 2.0.0... so maybe you can tell me if this is a bug or feature? Should be it possible do same with 2.x? Or not anymore due to some breaking changes or something? What I can assume, with provided jib maven plugin configuration as result, it's picking *.jar.original file from target directory instead of *.jar. and renames it to *.original.jar file and then given command in args is failing... Thank you. Regards |
Right, the intention is to use Moving forward, for your example to continue to work in 2.0.0, you might need to do something like(normally jib injects all this in, but given that you're using a custom entrypoint): - <arg>java -jar /tmp/classpath/*.jar</arg>
+ <arg>java -cp /tmp/classpath/*:/tmp/libs/* my.package.MainClass</arg> EDIT: corrected wildcard/paths in classpath |
@daggerok the reason I'm probing about debugging is because you said:
If your setup it to enable JDWP so that you can connect a debugger, there's an alternative to using a custom startup script. You can configure the JVM for debugging with the docker run -e JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,address=8000" -p 8000:8000 my-java-image
Packaging a fatjar leads to poorer building and execution times. With a fat jar, a single source change results in rebuilding the fatjar, and so a new layer must be created and pushed. With Jib, we can just rebuild and push a new layer with just the .class and resource files, which is much faster. Most fatjars have to do some additional initialization and so are slower on startup. For modern web apps, which seem to have large numbers of dependencies, Jib's optimizations can make a large difference in both push and startup times. |
Thank you all, just in case you want to try, to make it easier I have prepared steps for reproduce in a simple multi module spring boot project for jib configured to use far jar:
Max |
@daggerok correct, because it's intentionally not using the fatjar in 2.0.0 - you can try something like #2267 (comment) In your test project specifically you would want to do
|
Got it. |
Hello!
Environment:
Description of the issue:
I'm using next multi-module maven configuration for fat jars in my root parent pom.xml:
and this configuration on 1.8.0 and 1.7.0 versions works well. But with 2.0.0 I'm getting error related to wrong jar file:
docker run --rm -it --name my-app daggerok/my-app no main manifest attribute, in /tmp/classpath/app-1.0.0-SNAPSHOT.original.jar
Seems like previously (with versions: 1.7.0 or 1.8.0), generated by spring-boot maven plugin *.jar.original file wasn't copy, but since 2.0.0 it's for some reasons file
app-1.0.0-SNAPSHOT.jar.original
now is copying as build artifact asapp-1.0.0-SNAPSHOT.original.jar
or something else...
Expected behavior:
Application should start normally by picking right jar file:
app-1.0.0-SNAPSHOT.jar
, notapp-1.0.0-SNAPSHOT.original.jar
Steps to reproduce:
Just use provided jib maven plugin config for 1.7.0 or 1.8.0 versions to verify it works correctly.
Can you point me what I have to adjust to get same behaviour as with previous jib maven plugin versions?
Thanks in advice!
Regards,
Maksim
The text was updated successfully, but these errors were encountered: