slachiewicz opened a new issue, #14015: URL: https://github.com/apache/maven/issues/14015
### Affected version 3.10.1. Not affected: 3.10.0, 3.9.16, 4.0.0-rc-7. ### Bug description A plugin loaded with `<extensions>true</extensions>` can register its own `LifecycleMapping` for a packaging that core already maps. groovy-eclipse-compiler 3.9.1 does this for `jar`, `war` and `ejb` to bind `add-groovy-build-paths` to `initialize`. Maven 3.10.1 ignores the extension's mapping and uses core's: the Groovy step does not run, `target/classes` stays empty, no tests run, and the build succeeds with an empty jar, ejb or war. `dependency:analyze-only` then reports every declared dependency as unused. Reported on the users list in the 3.10.1 announcement thread. Reproducer: the POM below plus one class in `src/main/groovy/demo/Hello.groovy`, run with `mvn clean verify`. - 3.10.0: `groovy-eclipse-compiler:3.9.1:add-groovy-build-paths` runs, `Hello.class` is compiled, `analyze-only` passes. - 3.10.1: the execution is missing, nothing is compiled, `analyze-only` fails with `Unused declared dependencies found`. <details> <summary>pom.xml</summary> ```xml <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> <groupId>demo</groupId> <artifactId>gec-lifecycle-mapping</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <maven.compiler.release>17</maven.compiler.release> </properties> <pluginRepositories> <pluginRepository> <id>groovy-plugins-release</id> <url>https://groovy.jfrog.io/artifactory/plugins-release</url> </pluginRepository> </pluginRepositories> <dependencies> <dependency> <groupId>org.apache.groovy</groupId> <artifactId>groovy</artifactId> <version>5.0.8</version> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.13.4</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.14.1</version> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>3.9.1</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>5.0.8-02</version> </dependency> </dependencies> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.5.1</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.6.1</version> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <version>3.11.0</version> <executions> <execution> <id>analyze</id> <goals><goal>analyze-only</goal></goals> <configuration><failOnWarning>true</failOnWarning></configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>3.9.1</version> <extensions>true</extensions> </plugin> </plugins> </build> </project> ``` </details> The regression comes from #13582. `DefaultLifecyclePluginAnalyzer.getPluginsBoundByDefaultToAllLifecycles` used to call `plexusContainer.lookup(LifecycleMapping.class, hint)`, which returns the highest-ranked visible mapping, and 3.9.x calls `lifecycleMappings.get(packaging)`, which does the same. It now copies the injected map with `new HashMap<>(this.lifecycleMappings)`. Sisu's injected map lists every visible bean in rank order, so the hint `jar` appears twice, and `putAll` keeps the last, lowest-ranked entry: core's mapping. `DefaultLifecycles.getLifeCycles()` copies `this.lifecycles` the same way, where 3.10.0 also looked each lifecycle up by id. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
