jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-1886

Need way to share code between report mojos and main build mojos

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Reopened Reopened
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.1
  • Fix Version/s: Issues to be reviewed for 3.x
  • Component/s: Plugin API
  • Labels:
    None
  • Complexity:
    Intermediate

Description

For example in the clover plugin i have both report mojos and main build mojos. They need to share lots of configuration elements and common methods but it's not easy to do so because each type needs to extend either AbstractMavenReport or AbstractMojo. Of course I could not extend AbstractMavenReport and instead implement the interface but then I'll have to reimplement all its methods.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Brett Porter added a comment - 28/Dec/05 7:00 AM

can you elaborate on what you mean here?

If they are sharing types - there is no reason this can't be done with a subelement (eg, like MavenArchiveConfiguration in jar, war, etc).

Other things might be sharable by the plugin context.

Please reopen if neither of these address your needs.

Show
Brett Porter added a comment - 28/Dec/05 7:00 AM can you elaborate on what you mean here? If they are sharing types - there is no reason this can't be done with a subelement (eg, like MavenArchiveConfiguration in jar, war, etc). Other things might be sharable by the plugin context. Please reopen if neither of these address your needs.
Hide
Permalink
Vincent Massol added a comment - 28/Dec/05 7:15 AM

I'm talking about sharing configuration elements (fields).

Here's an example:

<configuration>
<cloverDatabase>...</cloverDatabase>
<jdk>...</jdk>
[...]

Is there any doc on the plugin context? I don't think this is what I'm after though.

Try writing a plugin which has both reporting mojos and main mojos and you'll see what I mean. Alternatively you could have a look at the clover plugin. Search for MNG-1886 in the code and you'll find the places where it's awkward and would ideally require a better design.

This is an issue about code duplication, maintenance and consistency in general. I think the issue's title can be changed to; "How to share configuration elements between mojos when inheritance is not possible".

The example you give about the MavenArchiveConfiguration require the introduction of another level of configuration for users. I'm talking about sharing the top level.

Thanks

Show
Vincent Massol added a comment - 28/Dec/05 7:15 AM I'm talking about sharing configuration elements (fields). Here's an example: <configuration> <cloverDatabase>...</cloverDatabase> <jdk>...</jdk> [...] Is there any doc on the plugin context? I don't think this is what I'm after though. Try writing a plugin which has both reporting mojos and main mojos and you'll see what I mean. Alternatively you could have a look at the clover plugin. Search for MNG-1886 in the code and you'll find the places where it's awkward and would ideally require a better design. This is an issue about code duplication, maintenance and consistency in general. I think the issue's title can be changed to; "How to share configuration elements between mojos when inheritance is not possible". The example you give about the MavenArchiveConfiguration require the introduction of another level of configuration for users. I'm talking about sharing the top level. Thanks
Hide
Permalink
Brett Porter added a comment - 28/Dec/05 7:25 AM

ok, there's something else here. I guess its going to be something like MavenArchiveConfiguration, but with a @parameter nested="false" or something like that. Won't be done before 2.1 if at all.

As a side note, AbstractMavenReport already extends AbstractMojo so you can achieve this anyway, but it means making a report of your mojo. A bit ugly.

I think there is an overall need to improve configurability of plugins (eg, validation of elements inside nested types, more sharing, etc).

Show
Brett Porter added a comment - 28/Dec/05 7:25 AM ok, there's something else here. I guess its going to be something like MavenArchiveConfiguration, but with a @parameter nested="false" or something like that. Won't be done before 2.1 if at all. As a side note, AbstractMavenReport already extends AbstractMojo so you can achieve this anyway, but it means making a report of your mojo. A bit ugly. I think there is an overall need to improve configurability of plugins (eg, validation of elements inside nested types, more sharing, etc).

People

  • Assignee:
    Unassigned
    Reporter:
    Vincent Massol
Vote (2)
Watch (1)

Dates

  • Created:
    21/Dec/05 2:33 PM
    Updated:
    12/Jun/08 6:31 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.