Skip to content

Plugin's lifecycle-mapping-metadata.xml applies irrespective of phase #2193

Description

@kwin

A lifecycle-mapping-metadata.xml shipped with a Maven plugin like https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml is considered no matter to which phase the configured goal is bound, e.g.:

<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <goals>
                    <goal>apply</goal>
                    <goal>check</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <execute>
                    <runOnIncremental>true</runOnIncremental>
                    <runOnConfiguration>false</runOnConfiguration>
                </execute>
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

would execute goal apply even if bound to phase verify in the POM.xml (which is usually not relevant for incremental builds).

As the default execution of maven plugins introduced in https://github.com/eclipse-m2e/m2e-core/blob/main/RELEASE_NOTES.md#mojos-without-a-mapping-are-now-executed-by-default-in-incremental-builds only ever execute by default up to phase process-test-classes the same should be replicated for plugins carrying an explicit mapping for consistency reasons.

Image

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions