Skip to content

[MNG-5885] Optimize execution when phases of same lifecycle are called #7772

Open

Description

@jira-importer

Robert Scholte opened MNG-5885 and commented

In case someone calls compile package there's no need for the separate compile call. Now the lifecycle is executed twice: once until compile and once again until package.

Note: package compile is weird due to its order, but should not be optimized. compile resources:copy-resources package is a bit complicated. Ideally this should call all phases up until compile, followed by resources:copy-resources, followed by the process-classes to package phases.


Affects: 3.3.3

This issue is a sub-task of MNG-5665

2 votes, 8 watchers

Activity

  1. jira-importer commented on Dec 18, 2015

    @jira-importer
    Author

    Christian Schulte commented

    If someone tells Maven to execute 'compile package', it should do just that. Garbage in -> garbage out, IMHO.

  2. jira-importer commented on Feb 3, 2016

    @jira-importer
    Author

    Paul Benedict commented

    I tend to agree with you but for a different reason. First, "compile package" does not look like garbage; it looks like someone just explicitly listed out the phases they are most interested in. However, it's surprising this is not a runtime error, honestly. I don't believe optimizing is the right solution here but rejecting the syntax altogether. I don't believe we should allow more than one phase to be explicitly listed.

  3. jira-importer commented on Dec 8, 2017

    @jira-importer
    Author

    Daniel Cruver commented

    A potential solution to this is to detect when phases of the same lifecyle are adjacent to each other on the command line an report a run-time error.

    For example:
    mvn clean install deploy

    ERROR: the phases install and deploy both belong to the 'default' Lifecycle, please build with the command 'mvn clean deploy'.

  4. jira-importer commented on Dec 8, 2017

    @jira-importer
    Author

    Robert Scholte commented

    An error is way too offensive to me. And I expect that the meaning of this command gets a new meaning in a multimodule project: run up this phase for every module before continuing up until the next phase. I still need to work on this...

  5. added
    priority:major
    on Jul 6, 2025
  6. modified the milestones: , 4.x on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:major

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions