-
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
class org.gradle.api.internal.provider.DefaultProperty cannot be cast to class java.lang.String #3396
Comments
After I check the code https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java#L373 I change this:
to this and it success:
Maybe we should call the toString method of the property instead of directly cast as String. |
Thanks for the report. I learned that I'd say this is a current limitation of Jib. For now, you can do If anyone interested in fixing this, we welcome contributions. I am not a Gradle expert, so not sure what's the best way to deal with in the Jib code. |
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
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
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
…3435) * Fix class cast exception in gradle plugin main class detection logic 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 #3396 * Update jib-gradle-plugin/CHANGELOG.md Co-authored-by: Chanseok Oh <[email protected]>
Environment:
Description of the issue:
run
./gradlew web:jibBuildTar
and it fails.Expected behavior:
run
./gradlew web:jibBuildTar
and it success.Steps to reproduce:
jib-gradle-plugin
Configuration:.../buildSrc/src/main/kotlin/jib.gradle.kts :
web/build.gradle.kts :
Log output:
Additional Information:
The jib config file is in the buildSrc folder (.../buildSrc/src/main/kotlin/jib.gradle.kts)
The text was updated successfully, but these errors were encountered: