Skip to content

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

@wleese

Description

@wleese

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, 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions