You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Martin Kanters (Jira)" <ji...@apache.org> on 2021/05/28 14:39:00 UTC
[jira] [Commented] (MNG-6566) @Execute should not re-execute goals
[ https://issues.apache.org/jira/browse/MNG-6566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17353384#comment-17353384 ]
Martin Kanters commented on MNG-6566:
-------------------------------------
Note; this solution only works for optimization in one project. It will not optimize Mojo executions between projects in a multi-module build. To illustrate, imagine a plugin called custom-plugin, bound on the package phase, requiring a compile execution. This is done on a single-module build:
{{> mvn package}}
{{maven-resources-plugin:resources}}
{{maven-compile-plugin:compile}}
{{custom-plugin:goal (prerequisite: requires compile phase)}}
{{>>> forks: maven-resources-plugin:resources (MNG-6566 prevents executing this)}}
{{>>> forks: maven-compile-plugin:compile (MNG-6566 prevents executing this)}}
{{custom-plugin:goal (actual execution)}}
{{maven-jar-plugin:jar}}
Now imagine a multi-module build, where a Mojo is executed on the aggregator project, requiring a goal on the submodules.
An example is javadoc:aggregate-jar, this Mojo requires a compile on all of the submodules of the aggregator project.
Imagine that it is bound on the package phase of the "parent" project. "parent" contains two modules, "module-a" and "module-b".
{{> mvn package}}
{{<starts building parent>}}
{{maven-javadoc-plugin:aggregate-jar (prerequisite: requires compile phase on children)}}
{{>>> forks: maven-resources-plugin:resources @ module-a}}
{{>>> forks: maven-compile-plugin:compile @ module-a}}
{{>>> forks: maven-resources-plugin:resources @ module-b}}
{{>>> forks: maven-compile-plugin:compile @ module-b}}
{{maven-javadoc-plugin:aggregate-jar (actual execution)}}
{{<starts building module-a>}}
{{maven-resources-plugin:resources @ module-a}}
{{maven-compile-plugin:compile @ module-a}}
{{<starts building module-b>}}
{{maven-resources-plugin:resources @ module-b}}
{{maven-compile-plugin:compile @ module-b}}
The last four Mojo executions will not be skipped, even though they were already executed in the fork of "parent".
A new ticket is raised to fix this problem: https://issues.apache.org/jira/browse/MNG-7163
> @Execute should not re-execute goals
> ------------------------------------
>
> Key: MNG-6566
> URL: https://issues.apache.org/jira/browse/MNG-6566
> Project: Maven
> Issue Type: Improvement
> Components: Plugins and Lifecycle
> Reporter: Robert Scholte
> Assignee: Martin Kanters
> Priority: Major
> Fix For: 4.0.0, 4.0.0-alpha-1
>
>
> We're getting quite a lot of requests for <goal>-no-fork goals, because now often plugins are executed twice because of retriggering plugins due to the @Execute -annotation.
> Maven should be able to discover if there's a need to re-execute those goals/lifecycles.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)