Skip to content

goal bindings in pom.xml executed BEFORE lifecycle ones with Maven 4 #12331

Description

@hboutemy

Affected version

4.0.0-RC5

Bug description

found while working on apache/maven-scm-publish-plugin#152 (comment)

for default lifecycle, Maven 4 works as Maven 3: goal binding from pom.xml runs after lifecycle one

but for site or clean, Maven 4 runs binding from pom.xml first

reproducer: pom.xml

with Maven 3:

❯ mvn package && mvn -V clean
Apache Maven 3.9.12 (848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1)
Maven home: /home/herve/.sdkman/candidates/maven/3.9.12
Java version: 25, vendor: Azul Systems, Inc., runtime: /home/herve/.sdkman/candidates/java/25-zulu
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "6.8.0-124-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< org.apache.maven.its:test-lifecycle >-----------------
[INFO] Building Test lifecycle bindings vs added ones 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ test-lifecycle ---
[INFO] Deleting /home/herve/dev/maven/sources/plugins/tools/target
[INFO] 
[INFO] --- antrun:3.2.0:run (target) @ test-lifecycle ---
[INFO] Executing tasks

(failure expected)

with Maven 4:

❯ mvn package && mvn -V clean
Apache Maven 4.0.0-SNAPSHOT (61b7c60e4211f024564ff89964dac825afb3146e)
Maven home: /home/herve/.sdkman/candidates/maven/4.0.0-SNAPSHOT
Java version: 25, vendor: Azul Systems, Inc., runtime: /home/herve/.sdkman/candidates/java/25-zulu
Default locale: fr_FR, platform encoding: UTF-8, time zone: Europe/Paris
OS name: "linux", version: "6.8.0-124-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------------------------< org.apache.maven.its:test-lifecycle >------------------------------------------
[INFO] Building Test lifecycle bindings vs added ones 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] ---------------------------------------------------------[ jar ]----------------------------------------------------------
[INFO] 
[INFO] --- antrun:3.2.0:run (target) @ test-lifecycle ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] 
[INFO] --- clean:3.4.0:clean (default-clean) @ test-lifecycle ---
[INFO] Deleting /home/herve/dev/maven/sources/plugins/tools/target

same results with mvn site

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions