You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Cyrille Le Clerc (Jira)" <ji...@apache.org> on 2024/08/19 22:05:00 UTC

[jira] [Updated] (MNG-8217) `ClassNotFoundException` in `@PreDestroy` method when Maven extension declared in `pom.xml`

     [ https://issues.apache.org/jira/browse/MNG-8217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cyrille Le Clerc updated MNG-8217:
----------------------------------
    Summary: `ClassNotFoundException` in `@PreDestroy` method when Maven extension declared in `pom.xml`  (was: `{{ClassNotFoundException}}` in `{{@PreDestroy}}` method when Maven extension declared in `{{pom.xml}}`)

> `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 message was sent by Atlassian Jira
(v8.20.10#820010)