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

Add DependencyResolverResult.getModuleName(Path) method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-beta-4, 4.0.0
    • Dependencies
    • None

    Description

      Clarify the meaning of "module" in documentation, then add two methods for getting Java module information from a `DependencyResolverResult`:

      • `getModuleName(Path)` returns a `java.lang.String`
      • `getModuleDescription(Path)` returns a `java.lang.module.ModuleDescriptor`

      "Get name" may seem redundant with "get description" because the name can be obtained from the description by `ModuleDescriptor.name()`. The difference is that "get name" fallbacks on the `Automatic-Module-Name` attribute of `META-INF/MANIFEST.MF` if the module descriptor is not found.

      The rational for providing those methods in the API is because it allows to use the cache managed by the `DefaultDependencyResolverResult` implementation. It avoids decoding many times the `module-info.class` files. Plugins need those information for managing `--add-reads` and similar options.

      Alternative: It would be more natural to have `getModuleName()` and `getModuleDescription()` methods in `Dependency`. But it would imply that dependency contains a `getPath()` method. I'm not sure why it is not already the case.

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            cstamas Tamas Cservenak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: