Hi all,

With JB Onofré we discussed a surprising behavior of maven plugin execution
chain.
Long story short it is this piece of code:
https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java#L93
.

The overall idea is: if the phase is not explicit then resolve the plugin
to get its descriptor and check its default phase else use the user
explicit phase.

This looks quite good and logical and it can save some plugin resolution
(which should be ~0 saved time after first cache).

However it has a major drawback (what JB hit and why we discussed it): if
you have a plugin which can't be resolved for whatever reason, setting a
phase will not make the build being broken until you call it whereas not
setting a phase will fail whatever lifecycle you call since you will have
to resolve the plugin to get its default phase.

Wonder if we would gain to just ensure the plugin is always resolved for
behavior consistency.
Idea being that setting or not a phase does not have side effects for end
users.

Side note: didn't check the whole code but can likely apply to other
attributes so always resolving sounds like the sanest default to me.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>

Reply via email to