[
https://issues.apache.org/jira/browse/MNG-8217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17904283#comment-17904283
]
Cyrille Le Clerc commented on MNG-8217:
---------------------------------------
[~cstamas], [~gnodet] could you by any chance have a look at this issue?
> `ClassNotFoundException` in `@PreDestroy` method when Maven extension
> declared in `pom.xml`
> -------------------------------------------------------------------------------------------
>
> Key: MNG-8217
> URL: https://issues.apache.org/jira/browse/MNG-8217
> Project: Maven
> Issue Type: Bug
> Components: Core
> Affects Versions: 3.9.8
> Reporter: Cyrille Le Clerc
> Priority: Major
>
> 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|https://github.com/open-telemetry/opentelemetry-java-contrib/issues/1391]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)