Description
The `@PreDestroy` method of JSR 330 based Maven extensions fail with a `ClassNotFoundException` when the extension is declared through the `<build><extensions>...</extensions></build>`.
The problem doesn't happen when the Maven extension is declared through the `.mvn/extensions.xml` file or `mvn -Dmaven.ext.class.path=...` command line arg.
This suggest the classes of the extension are unloaded too early, before `@PreDestroy` is invoked, when when the extension is declared through the `<build><extensions>...</extensions></build>`.
Test case:
- https://github.com/cyrille-leclerc/maven-extension-test/tree/f2cc78c15e0b9a59547c111db69e2c261c9872ea/test-jsr-330-extension/src/maven-it/extension-declared-in-pom-xml
- https://github.com/cyrille-leclerc/maven-extension-test/tree/f2cc78c15e0b9a59547c111db69e2c261c9872ea/test-jsr-330-extension/src/maven-it/extension-declared-in-dot-mvn-extensions-xml
This problem impact the OpenTelemetry Maven Extension: opentelemetry-maven-extension NoClassDefFoundError while running package #1391