Open franklini opened 7 years ago
It sounds like you're running mvn deploy
and getting this result?
Maven will sort all the modules in your reactor, and run your desired command (deploy
in this case) against each module in order. If push configuration for your image is in context in the module where the image is built (and it would be, if it was in your root pom and your root pom is the parent pom of each submodule), then Maven will figure out that it needs to build the submodule that builds your image, and run mvn deploy
on it - which will push
the image since you've bound the d-m-p's push
to the deploy
phase.
You want the execution of d-m-p that configures the push
goal happen after everything else, right? Without seeing your project structure and the dependency relationships between your modules and the root pom, it is hard to give specific advice, but it sounds like your best bet would be to add a new submodule to your reactor that depends on the "last" submodule that gets built normally. Keep the configuration of the execution of the d-m-p that configures push
in your root pom (a <pluginManagement>
block would be the best place), but bind it to the deploy
phase only in this new submodule.
Then, when you run mvn deploy
,
d-m-p
execution configured for any lifecycle phase.d-m-p
execution configured for any lifecycle phase.d-m-p
execution configured for any lifecycle phase.push
to the deploy
phase will have mvn deploy
run on it, and it will push a Docker image.Hi Gengar003,
May I start first by thanking you for your excellent tips. tried it this morning and it actually worked although I had to recreate the image (for some reason I couldn't push the image I created at the service-docker module). The only side effect was that i then couldn't push the jars created by the other modules. Any tip on how to overcome this?
Thanks in advance
Moduler project with deploy phase fails to deploy the image at the end
Info
mvn -v
) : Maven 3.3.9The problem I encounter is that my image gets pushed right after it gets created. my other jars gets pushed at the end correctly when all my modules and tests have passed correctly (added a maven-deploy-plugin with configuration.deployAtEnd set to true to enable this).
The image getting pushed this early is problematic as if a problem occurs during the build then you have a faulty image already in you repository
Is their anyway you can make the plugin push the image in the deploy lifecycle in a modular build?
Thanks you in advance