Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-8217

`ClassNotFoundException` in `@PreDestroy` method when Maven extension declared in `pom.xml`

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.9.8
    • None
    • Core
    • None

    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:

      This problem impact the OpenTelemetry Maven Extension: opentelemetry-maven-extension NoClassDefFoundError while running package #1391

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            cyrille@cyrilleleclerc.com Cyrille Le Clerc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: