Just a few remarks:

1) There might be situations were no cache is there so it can hurt performance to resolve "useless" plugins (e.g. from deploy phase) and probably long dependency chains.

2) one should not optimize for the error case, if I never test my project it is not the task of maven to help me in that regards

3) If it is cause by a temporary failure I might be happy that my build still works if I do not execute that phase (yet)

4) I don't think its inconsistent e.g. if I call mvn validate it might not download dependencies, if I call mvn compile only some of them so in general it is consistent to delay things as much as possible.

Am 26.06.23 um 21:28 schrieb Romain Manni-Bucau:
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>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to