GoogleContainerTools / GoogleContainerTools/jib

jib-maven-plugin 3.5.1 incompatible with Guava 33+ — ClassNotFoundException: com.google.common.util.concurrent.Platform

Open
#4,503 0 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

**Environment:**

- Jib version: `jib-maven-plugin 3.5.1` / `jib-core 0.28.0`
- Build tool: Maven 3.9.x
- OS: Ubuntu 24.04 (GitHub Actions runner)

**Description of the issue:**

`jib-core 0.28.0` depends on `com.google.guava:guava:32.1.2-jre` at `runtime` scope (non-shaded). When another dependency in the same Maven project pulls in Guava 33+ transitively, Maven's plugin classloader resolves the higher version, replacing the Guava version Jib declared.

Guava 33.0.0 removed `com.google.common.util.concurrent.Platform`. Jib uses this class in its parallel layer-download thread pool. The result is a crash mid-pull:

```
Exception in thread "pool-8-thread-4" java.lang.NoClassDefFoundError: com/google/common/util/concurrent/Platform
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.Platform
```

The secondary symptom is a misleading I/O error from the registry:

```
[ERROR] I/O error for image [.../amazoncorretto]:
[ERROR] java.net.SocketException
[ERROR] Socket closed
```

followed by:

```
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.5.1:dockerBuild:
Premature end of Content-Length delimited message body (expected: 159,828,502; received: 50,068,336)
```

The socket error is a consequence of the thread pool crashing, not the root cause.

**Steps to reproduce:**

Add any dependency that transitively pulls in Guava 33+ alongside `jib-maven-plugin 3.5.1`. For example, `net.sourceforge.pmd:pmd-core:7.22.0` or `org.testcontainers:testcontainers:2.0.5` both do this. Then run `jib:dockerBuild`.

**Expected behavior:**

Jib should either shade Guava internally (so it is not subject to classpath conflicts), or update its Guava dependency to a version that does not use the removed `Platform` class.

**Workaround:**

Pin Guava to `32.1.2-jre` explicitly inside the `jib-maven-plugin` `` block in `pluginManagement`. This scopes the override to Jib's plugin classloader and does not affect the project's own dependency tree:

```xml

com.google.cloud.tools
jib-maven-plugin
3.5.1


com.google.guava
guava
32.1.2-jre


...

```

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.