GoogleContainerTools / GoogleContainerTools/jib

jvmFlags.add throws UnsupportedOperationException in gradle jib plugin

Open
#4,222 2 comments 0 reactions 0 assignees View on GitHub
priority: p3 type:bug
Dominant language
Java
Stars
14.5k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

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**:

1. initialize jvmFlags with mutableList
2. 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.