Cyrille Le Clerc created MNG-8217:
-------------------------------------

             Summary: `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


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)

Reply via email to