Open hrstoyanov opened 3 months ago
Ok, so I start using containerizedMode packed:
containerizingMode = 'packaged'
container{
entrypoint = [
"java",
'--module-path', '/app/classpath:/app/libs',
'--module', 'my.module/my.App'
]
mainClass = 'NotNeeded'
}
and that seem to prevent Jib from unpacking the main module. I was able to run my app as a 100% modular app, no classpaths involved. Still unhappy about:
UPDATE: actually, searching for mainClass
even when setting entrypoint
is WAI. See https://github.com/GoogleContainerTools/jib/issues/4280#issuecomment-2323346289.
Not ignoring mainClass
when setting entrypoint
seems like a regression or a bug, because it's not going to be used anyway.
https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#container-object
Regression confirmed - commenting out the mainClass below triggers main class discovery:
jib {
containerizingMode = 'packaged'
container {
entrypoint = [
"java",
'--module-path', '/app/classpath:/app/libs',
'--module', 'my.module/my.App'
]
//mainClass = 'NotNeeded'
}
}
Execution failed for task ':webapp:jib'.
> Check the full stace trace, and if the root cause is from ASM ClassReader about unsupported class file version, see https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#i-am-seeing-unsupported-class-file-major-version-when-building
Actually, it's WAI that Jib searches for a main class even if you set a custom entrypoint
. Jib still needs to know the main class to generate the /app/jib-main-class-file
to support the popular use-case where the user wants to know and use the main class that Jib has found in their custom entrypoint
. But I agree this isn't ideal for the Java module use-case.
Environment:
Description of the issue:
I would like to specify all of these mylsef:
I have used the below configuration, but this plugin still tries to infer main class and unzip the jar with the main class.
Expected behavior:
I want Jib to stop doing so opinionated and classpath-centric, and allow me to set up main module path and main module myself.