You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[question] why are some plugins bound to the package phase executed by eclipse lifecycle mapping by default and others not? #1792
I had a look inside the maven-dependency-plugin jar but did not observe any META-INF/m2e lifecycle mapping that could explain the execution. I clearly observe the junit dependency being copied to target/dependency by the Eclipse workspace build (no manual maven execution).
Is the maven-dependency-plugin treated special by m2e?
changed the title [-][question] why are some plugins in the package phase executed by eclipse lifecycle mapping by default and others not?[/-][+][question] why are some plugins bound to the package phase executed by eclipse lifecycle mapping by default and others not?[/+]on Jul 30, 2024
In your screenshot you can see that the antrun plugin is ignored (I assume it has a mapping for that), the dependency plugin is executed because mojos are executed by default if not otherwise specified.
@laeubi are you sure? that is the core of my question: I thought only plugins bound to "interesting phases" (i.e. up to compile) are executed by eclipse? at least that's what is written in the linked page.
Thanks for that pointer, that's good to know. So the package phase is an "interesting" phase for m2e? I mean, plugins bound to test/install/deploy are surely never executed by m2e, right?
In your screenshot you can see that the antrun plugin is ignored (I assume it has a mapping for that), the dependency plugin is executed because mojos are executed by default if not otherwise specified.
I checked the plugin jar and don't see a META-INF/m2e folder. Are there other ways to specify m2e mappings that I can check?
m2e ship with some default mappings ifecycle-mapping-metadata.xml and as far as I know every phase can be interesting. The question is more do you want the antrun to execute (than you can enable it e.g with processing instructions (I can't find the n&n at the moment maybe @HannesWell knows them?) or if you like to disable the maven-dependency-plugin?
I am mainly trying to update my mental model of how m2e is supposed to work with relation to the package phase: I was surprised by the maven-dependency-plugin being executed, because I thought m2e would never automatically execute plugins bound to the package phase. Now you pointed me to the release notes that say that m2e executes all plugins by default, which I think is not the case at least for the test/install/deploy-phases. I believe my custom plugins bound to the package phase are also not executed by default but I have to recheck those.
I tried to click on "Open workspace lifecycle mappings metadata" but got an error message and an empty editor. Edit: Now it works (but this mapping is empty).
Yes it is not always easy when it comes to mappings, but you can open the LifeCycle Mappings as a view to at least get the info what is executed.
In this particular case I think the reason is that m2e has a default mapping for maven-dependency-pluginhere that is used when nothing else is configured.
So even if the package-phase is "uninteresting" by default, if there is a mapping (either implicit or explicit) m2e can execute mojos in such a phase.
So here we have:
maven-antrun-plugin:run has no explicit or implicit binding and package phase is uninteresting -> ignored
maven-dependency-plugin:copy-dependency has implicit default binding -> execute regardless of phase.
Activity
[-][question] why are some plugins in the package phase executed by eclipse lifecycle mapping by default and others not?[/-][+][question] why are some plugins bound to the package phase executed by eclipse lifecycle mapping by default and others not?[/+]laeubi commentedon Jul 30, 2024
In your screenshot you can see that the antrun plugin is ignored (I assume it has a mapping for that), the dependency plugin is executed because mojos are executed by default if not otherwise specified.
reto-hoehener commentedon Jul 30, 2024
@laeubi are you sure? that is the core of my question: I thought only plugins bound to "interesting phases" (i.e. up to compile) are executed by eclipse? at least that's what is written in the linked page.
laeubi commentedon Jul 30, 2024
See https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#mojos-without-a-mapping-are-now-executed-by-default-in-incremental-builds
reto-hoehener commentedon Jul 30, 2024
Thanks for that pointer, that's good to know. So the package phase is an "interesting" phase for m2e? I mean, plugins bound to test/install/deploy are surely never executed by m2e, right?
I will check the maven-antrun-plugin...
reto-hoehener commentedon Jul 30, 2024
I checked the plugin jar and don't see a META-INF/m2e folder. Are there other ways to specify m2e mappings that I can check?
laeubi commentedon Jul 30, 2024
m2e ship with some default mappings
ifecycle-mapping-metadata.xmland as far as I know every phase can be interesting. The question is more do you want the antrun to execute (than you can enable it e.g with processing instructions (I can't find the n&n at the moment maybe @HannesWell knows them?) or if you like to disable the maven-dependency-plugin?reto-hoehener commentedon Jul 30, 2024
I am mainly trying to update my mental model of how m2e is supposed to work with relation to the package phase: I was surprised by the maven-dependency-plugin being executed, because I thought m2e would never automatically execute plugins bound to the package phase. Now you pointed me to the release notes that say that m2e executes all plugins by default, which I think is not the case at least for the test/install/deploy-phases. I believe my custom plugins bound to the package phase are also not executed by default but I have to recheck those.
I tried to click on "Open workspace lifecycle mappings metadata" but got an error message and an empty editor. Edit: Now it works (but this mapping is empty).
laeubi commentedon Jul 30, 2024
Yes it is not always easy when it comes to mappings, but you can open the LifeCycle Mappings as a view to at least get the info what is executed.
In this particular case I think the reason is that m2e has a default mapping for
maven-dependency-pluginhere that is used when nothing else is configured.So even if the package-phase is "uninteresting" by default, if there is a mapping (either implicit or explicit) m2e can execute mojos in such a phase.
So here we have:
maven-antrun-plugin:runhas no explicit or implicit binding andpackagephase is uninteresting ->ignoredmaven-dependency-plugin:copy-dependencyhas implicitdefaultbinding ->executeregardless of phase.