jvmFlags.add throws UnsupportedOperationException in gradle jib plugin
Hi awesome people who are working on this, this is not a blocker but something I thought would be nice for you to know 😄
Description of the issue: Bumping gradle jib plugin from version 4.3.1. to 4.4.1 was actually breaking change as it is not possible to add jvmFlags anymore after they have been initialized. We've find solution for it - we just create temporary list and assign flags at the end but still wanted to let you know about it. We use it in kotlin backend project.
- Jib version: 4.4.1
- Build tool: Gradle 8.5
- OS: macOS
- java (jvm target): 21
- kotlin: 1.9.23
Expected behavior: Bumping non-major version is not introducing breaking changes
Steps to reproduce:
- initialize jvmFlags with mutableList
- try to execute jvmFlags.add to add more flags and it will throw
java.lang.UnsupportedOperationException (no error message)and report it on line you are trying to do jvmFlags.add
jib-gradle-plugin Configuration:
I've pasted just small example what would break it
container {
.
.
jvmFlags = mutableListOf("some flags")
if (something) {
jvmFlags.add("new flag")
}
.
.
}
Log output:
java.lang.UnsupportedOperationException (no error message) at line where jvmFlags.add is called
@mpeddada1 @blakeli0 is this related to https://github.com/GoogleContainerTools/jib/pull/2975? If so, there may be a new way to specify the flags.
Downgrading to P3 as there is already a workaround.