Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5805

Custom packaging types: configuring DefaultLifecycleMapping mojo executions

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.9
    • Component/s: Plugins and Lifecycle
    • Labels:
      None

      Description

      Currently, DefaultLifecycleMapping does not support mapping phases to goals with a custom configuration (see maven-core/src/main/resources/META-INF/plexus/default-bindings.xml). It is impossible to bind, say, an assembly plugin to 'package' phase within a custom packaging type, since assembly plugin requires a meaningful configuration to be set.

      At my job, we have a number of poms, each serving a purpose of defining a lifecycle for a particular type of project (there's one for jar, a couple for wars and several more for other types of deployable artifacts).

      Now that I somewhat understand maven's lifecycle, It seems natural to convert such poms to custom packaging types, leaving only a single parent with global config and pluginManagement. But it is currently impossible, since we are using mostly standard plugins (only occasional dedicated ones) to configure projects' lifecycles.

      I did some digging around and put together a relatively straightforward change to maven-core: https://github.com/apache/maven/compare/master...atanasenko:mng-5805-lifecycle-mojo-config?w=1

      It both introduces support for specifying configuration and dependencies for mojo executions:

      <install>
        <mojos>
          <mojo>
            <goal>org.apache.maven.plugins:maven-install-plugin:2.4:install</goal>
            <configuration>...</configuration>
            <dependencies>...</dependencies>
          </mojo>
          <mojo>
            ...
          </mojo>
        </mojos>
      </install>
      

      as well as retains support for existing mapping syntax:

      <install>org.apache.maven.plugins:maven-install-plugin:2.4:install, ...</install>
      

      I will put together some its (as well as make sure that existing are running ok) and create a pull request for both. Also, there are a couple of changes that break API in org/apache/maven/lifecycle/Lifecycle.java and org/apache/maven/lifecycle/mapping/Lifecycle.java. How critical is it to mantain compatibility in those two?

      ITS: https://github.com/apache/maven-integration-testing/compare/master...atanasenko:mng-5805-lifecycle-mojo-config?w=1

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jvanzyl Jason van Zyl
                Reporter:
                atanasenko Anton Tanasenko
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: