-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
projectDependencies layer is omitted when executing a partial maven build #2697
Comments
I think this is a misuse of the reactor. Using |
True. Understood, I wasn't aware that artifacts from reactor-excluded dependencies are pulled from the local repo and not the other projects target directory (if available). To be honest, in our workflow we always use the I have edited the reproducer above, using the "install" phase. The question is then if |
I think this is dangerous. By I think Jib should not mark artifacts retrieved from external repositories as "project dependencies." |
If you have to continue using your workflow but still want a way to move such dependencies into a separate layer, see #1962 (comment) |
So @danielwegener generally maven isn't great at the multimodule workflows for non lifecycle goals. This is something we, as the jib team, have had to grapple with.
will try to trigger There are two options.
both of which are not super ideal, but it is the consequence of maven's build structure.
To this point, you are right, there is some value is clearing this up. Technically we mean "reactor". |
Yes, I've tried the layer-filter-extension even before I knew the
I do not see that this is adding any new danger by considering "potentially not just yet built"-dependencies beeing project dependencies. Other packing plugins like the maven-war-plugin or the assembly plugin AFAIK would also do not make a big difference if a multimodule-dependency was built "just in this reactor run" or from earlier seperate builds. The resulting artifact would in most cases be the same. For me as a user the practical purpose of the Said that, thanks for the comprehensive replies, I understand your points and I guess I can get what I want with a small jib-extension that post-processes the ContainerBuildPlan. |
I think the same happens when you |
I don't know much about @danielwegener I'd say the behavior isn't "desired" but an unfortunate limitation due to Maven. Unlike Gradle, Maven doesn't have a way to trigger running other plugins or some build phases from a plugin. Even for a single-module project, Jib explicitly requires the user to first run Adding @loosebazooka in case he has other things to say. |
Environment:
Description of the issue:
Running Maven with a partial reactor build, e.g.
./mvnw package jib:build -pl name-service
in the multimodule-example (https://github.com/GoogleContainerTools/jib/tree/master/examples/multi-module) does add the shared-library.jar to thedependencies
orsnapshot dependencies
layer, but not to theproject dependencies
layer.Expected behavior:
Reactor dependencies should not be added to the
dependencies
layer because every change in a reactor module would lead to the recreation of the (usually quite big) dependencies layer.Steps to reproduce:
export PROJECT_ID=<your own Google Cloud Platform project>
./mvnw install -pl !name-service
./mvnw package jib:build -pl name-service
OR (if no gcp address)./mvnw package jib:dockerBuild -pl name-service
docker history gcr.io/${PROJECT_ID}/multimodule/name-service:0.1.0
./mvnw install jib:build
OR (if no gcp address)./mvnw install jib:dockerBuild
docker history gcr.io/${PROJECT_ID}/multimodule/name-service:0.1.0
Log output:
For 4):
For 6):
Additional Information:
Problem is in
com.google.cloud.tools.jib.maven.MavenProjectProperties#getProjectDependencies
which uses
session.getProjects()
while it should usesession.getAllProjects()
.The text was updated successfully, but these errors were encountered: