Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-80

Detection of report goals always fails due to class loader separation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4
    • API, Plugin Plugin
    • None

    Description

      PluginUtils simply invokes Class.forName(String) to load a mojo class from the current project using its plugin class loader. However, as outlined in Guide to Maven Classloading, Maven plugins have no direct access to the classes of the current project.

      Besides, wouldn't the maven-plugin-plugin's report goal need @execute phase="compile" in order to ensure the mojo classes are existent prior to try to load them?

      Not sure about that but maybe it's worth to extend the mojo descriptor with a flag "report" such that this info could be retrieved without reflection in some far future but is derived by the goal extractors.

      P.S: You don't need to instantiate a class just to do instanceof checking. To check for a report mojo simply do:

      MavenReport.class.isAssignableFrom( clazz );
      

      Attachments

        Activity

          People

            siveton Siveton Vincent
            bentmann Benjamin Bentmann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: