Maven
  1. Maven
  2. MNG-2188

Report mojos should check canGenerateReport() when called directly

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.0.8
    • Component/s: Sites & Reporting
    • Labels:
      None
    • Flags:
      Patch

      Description

      There's a canGenerateReport() method in a ReportMojo. This method is called by the site phase to decide if the mojo should be called or not. This is cool. However the user can call directly the report mojo and in that case the canGenerateReport() method is not called automatically. Thus the solution for a plugin developer is to write:

      public void executeReport()
      {
          if (canGenerateReport() )
          { 
              [...]
          }
      }
      

      Which means that the canGenerateReport method is going to be called twice when mvn site is executed.

        Activity

        Vincent Massol created issue -
        Hide
        Walco van Loon added a comment -

        Patch for AbstractMavenReport to perform canGenerateReport() when it's called directly.

        Show
        Walco van Loon added a comment - Patch for AbstractMavenReport to perform canGenerateReport() when it's called directly.
        Walco van Loon made changes -
        Field Original Value New Value
        Attachment AbstractMavenReport-canGenerateReport-check.patch [ 19966 ]
        John Casey made changes -
        Fix Version/s 2.0.5 [ 12294 ]
        kenneyw made changes -
        Fix Version/s 2.0.5 [ 12294 ]
        Fix Version/s 2.0.6 [ 13010 ]
        Jason van Zyl made changes -
        Fix Version/s 2.0.6 [ 13010 ]
        Fix Version/s 2.0.x [ 13141 ]
        Jason van Zyl made changes -
        Patch Submitted [Yes]
        Hide
        Jason van Zyl added a comment -

        Already dealt with as report mojos can only be called by a report document renderer.

        Show
        Jason van Zyl added a comment - Already dealt with as report mojos can only be called by a report document renderer.
        Jason van Zyl made changes -
        Resolution Won't Fix [ 2 ]
        Status Open [ 1 ] Closed [ 6 ]
        Hide
        Vincent Massol added a comment -

        hmm... so does it mean users cannot call, say, mvn clover:clover anymore?

        Show
        Vincent Massol added a comment - hmm... so does it mean users cannot call, say, mvn clover:clover anymore?
        Hide
        Brett Porter added a comment -

        Vincent, I think your patch is correct. What the report document renderer does is irrelevant to clover:clover type executions. I'd suggest reopening and applying your own patch

        Show
        Brett Porter added a comment - Vincent, I think your patch is correct. What the report document renderer does is irrelevant to clover:clover type executions. I'd suggest reopening and applying your own patch
        Brett Porter made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Assignee Vincent Massol [ vmassol ]
        Resolution Won't Fix [ 2 ]
        John Casey made changes -
        Assignee Vincent Massol [ vmassol ] John Casey [ jdcasey ]
        Hide
        John Casey added a comment -

        I added this logic to the generate() method, since the execute method seems to disallow direct invocation at this point.

        Show
        John Casey added a comment - I added this logic to the generate() method, since the execute method seems to disallow direct invocation at this point.
        John Casey made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Closed [ 6 ]
        Fix Version/s 2.0.8 [ 13139 ]
        Fix Version/s 2.0.x [ 13141 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
        Mark Thomas made changes -
        Workflow jira [ 12712843 ] Default workflow, editable Closed status [ 12752725 ]
        Mark Thomas made changes -
        Flags Patch [ 10430 ]
        Patch Submitted Yes [ 10763 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
        Mark Thomas made changes -
        Workflow jira [ 12952137 ] Default workflow, editable Closed status [ 12989500 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        430d 6h 13m 1 Jason van Zyl 02/Jun/07 17:01
        Closed Closed Reopened Reopened
        24d 5h 4m 1 Brett Porter 26/Jun/07 22:06
        Reopened Reopened Closed Closed
        48d 17h 24m 1 John Casey 14/Aug/07 15:30

          People

          • Assignee:
            John Casey
            Reporter:
            Vincent Massol
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development