Open fthouraud opened 2 years ago
Also, the
jib-classpath-file
file does not reference this shared source set.
Just a minor point: jib-classpath-file
is for the classpath used to launch a JVM in the container. It won't talk anything about the structure of your Gradle source project.
Hmm, I think the current behavior in Jib includes files from main SourceSet
output and the gradle Configuration
(defaults to runtimeClasspath
, which do not include the shared source set files added to the modified main.runtimeClasspath
), which might explain this observation.
As support for custom gradle configurations was added in #3034, perhaps you could try overriding the default runtimeClasspath
configuration with something like:
jib {
...
configurationName = "mainRuntimeClasspath"
}
configurations {
mainRuntimeClasspath.extendsFrom runtimeClasspath
}
In general, Jib does not currently support configuration of custom gradle SourceSets, and the extraDirectories workaround you provided is another recommended approach to include these files. More context on this can be found in an earlier discussion in #1778.
@chanseokoh thank you for the precision. I was trying to prove that the shared source set was removed at some point which wasn't very clear.
@emmileaf thank you for the details! Considering Jib figures out the runtime dependencies using the configuration I'm not even sure I could expend unless I provide a JAR.
Do you plan on supporting this kind of structure in the future? It maybe isn't common practice but it feels weird to me that the additional source set is purely ignored.
Unfortunately support for this is not on the teamβs current roadmap, but we will keep this issue open as a feature request. Community contributions with a design proposal would also be welcomed.
@fthouraud Thank you for outlining the details of this use case and workaround!
Hi π
Environment:
Description of the issue: The
runtimeClasspath
of the main source set is incomplete.Given I have two source sets in the same module (I excluded tests source sets):
And I add the
shared
source set to the runtime classpath of the main one:When I look into the image, I cannot see the classes from the
shared
source set. But when I run this custom task:I can see the expected output (truncated for conciseness):
Also, the
jib-classpath-file
file does not reference this shared source set.Expected behavior:
I would have expected the image to contain everything from the configuration used.
Nonetheless, it is possible to get around this by using the
extraDirectories
closure:Steps to reproduce:
gradle jibBuildTar
,find build/jib-cache/layers -type f -print -exec tar -tvzf {} \;
The file from the shared source set should be missing.
jib-gradle-plugin
Configuration:Additional Information: I didn't try to reproduce it on a minimal Gradle project.
Regards.