-
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
Fix class cast exception in gradle plugin main class detection logic #3435
Fix class cast exception in gradle plugin main class detection logic #3435
Conversation
01f556e
to
fe8876c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! LGTM. Could you also update jib-gradle-plugin/CHANGELOG.md
?
I've added a note to the change log :) |
b2de760
to
93a052f
Compare
The main class detection logic in the gradle plugin always assumed that the `Main-Class` attribute, set in the main jar task, is a string. This is not always true, as it sometimes makes sense to set it to a provider of String in order to link multiple configurations together. The logic now tests the class of the value returned for the `Main-Class` attribute and in case of an `Provider<?>` value, it will call the `get` method. If the provider is not set, this will cause the task to fail. The resulting object is then transformed to a String. fixes GoogleContainerTools#3396
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
The main class detection logic in the gradle plugin always assumed that
the
Main-Class
attribute, set in the main jar task, is a string. Thisis not always true, as it sometimes makes sense to set it to a provider
of String in order to link multiple configurations together.
The logic now tests the class of the value returned for the
Main-Class
attribute and in case of an
Provider<?>
value, it will call theget
method. If the provider is not set, this will cause the task to fail.
The resulting object is then transformed to a String.
fixes #3396