GoogleContainerTools / GoogleContainerTools/jib

Align containerizingMode with Spring's Class Data Sharing (CDS) approach

Open
#4,271 0 comments 16 reactions 0 assignees View on GitHub
priority: p2 type: feature request
Dominant language
Java
Stars
14.5k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

**Environment**:

- *Jib version:* 3.4.3
- *Build tool:* Maven 3.9.7
- *OS:* Linux

**Description of the issue**:

While getting CDS to work with[ containerizingMode `packaged` & jib works](https://github.com/GoogleContainerTools/jib/issues/2471#issuecomment-2154859406), I'm left wondering if CDS is set up as good as can be. I'm in doubt, because there's still wildcard usage on the classpath.

I'm wondering if this plugin shouldn't align with what Spring describes.
https://docs.spring.io/spring-boot/reference/deployment/efficient.html#deployment.efficient

```
java -Djarmode=tools -jar my-app.jar extract

# app startup, no classpath specified
java -jar my-app/my-app.jar
```

This results in a directory/file layout like so:

```
./cdstestng-app-1.jar
./lib
./lib/exporter-trace-0.29.0.jar
./lib/opentelemetry-api-incubator-1.37.0-alpha.jar
[more libs]
```

**Expected behavior**:

I'd expect jib-maven-plugin to offer a `containerizingMode` that aligns with the way Spring recommends containerizing applications when using CDS. If for whatever reason such a mode shall not be provided, I'd expect some kind of documentation acknowledging the situation and explaining jib-maven-plugin's preferred to support CDS usage.

I read https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#i-want-to-containerize-a-jar ->

> The intention of Jib is to add individual class files, resources, and dependency JARs into the container instead of
> putting a JAR. This lets Jib choose an opinionated, optimal layout for the application on the container image, which
> also allows it to skip the extra JAR-packaging step.

.. which I /think/ does not conflict with what Spring is advising.

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.