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

extension.xml is ignored when extension is loaded by -Dmaven.ext.class.path

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.9.6
    • None
    • Class Loading
    • None

    Description

      As the title says: extension.xml is ignored when an extension is loaded by -Dmaven.ext.class.path, which makes it impossible to expose any additional packages.

      I am filing this as a bug due to this comment on MNG-6906, which says that lib/ext and -Dmaven.ext.class.path are supposed to be synonymous. Note that MNG-6906 is a related but different problem.

      When looking at org.apache.maven.cli.MavenCli, the problems aren't too hard to see:

      1. lib/ext extensions get loaded into the plexus.core realm (as per m2.conf), but -Dmaven.ext.class.path extensions are loaded into the maven.ext realm (as per MavenCli#setupContainerRealm()).
      2. loadCoreExtensions() operates on the coreRealm, but due to #1, the extensions are not in that realm. Also, the result of parseExtClasspath() is not passed to loadCoreExtensions(), so there is no way for loadCoreExtensions() to find the relevant files.

      The most obvious solution would be to call coreRealm.addURL() for each of the files discovered by parseExtClasspath(). This would solve #1 above which would implicitly fix #2. Though I don't know if it would have other consequences.

      If this is not a bug and is instead "works as designed", then https://maven.apache.org/guides/mini/guide-using-extensions.html needs to be updated to explain that the three methods of loading core extensions are not equivalent.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rdicroce Rich DiCroce
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: