Maven
  1. Maven
  2. MNG-2293

maven-plugin-descriptor: Not possible to define a default implementation for a field defined by its interface

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: Sites & Reporting
    • Labels:
      None

      Description

      MOJO-393 is about letting the user define an alternate configuration element, thus changing the way the webstart plugin works.

      For that the idea was to make the mojo field an interface, provide a default implementation in the plugin and let the user use plexus to instanciate a new implemenation.

      so for most users we would have:

      <configuration>
        <bla>
        </bla>
      </configuration>

      and for some:

      <configuration>
        <bla implementation="com....bla">
        </bla>
      </configuration>

      Unfortunately, today I am forced to specify the implementation in both cases. There's no way to inform the plugin to use the default implementation.

      The plugin.xml contains:

              <parameter>
                <name>bla</name>
                <type>...BlaInterface</type> <!-- that will fail -->
                 ...
              </parameter>

      I tried to use

       /**@parameter implementation="...BlaImplementation"*/
       BlaInterface bla;

      but that fails as well.

      Marking critical because it doesn't allow me add new features to the plugin without breaking the config.xml.

      1. dependency-mistery.log
        12 kB
        Jerome Lacoste
      2. it0106.tar.bz2
        2 kB
        Jerome Lacoste
      3. MNG-2293.diff
        20 kB
        Jerome Lacoste
      4. MNG-2293.diff
        27 kB
        Jerome Lacoste
      5. MNG-2293-plugins.diff
        1.0 kB
        Jerome Lacoste
      6. patch-MNG-2293.diff
        6 kB
        Jerome Lacoste
      7. patch-MNG-2293-source2.tar.bz2
        0.7 kB
        Jerome Lacoste

        Activity

        Hide
        Jerome Lacoste added a comment -

        Depend upon PLX-219, which was just fixed

        Show
        Jerome Lacoste added a comment - Depend upon PLX-219, which was just fixed
        Hide
        Jerome Lacoste added a comment -

        This is a tentative patch, meaning that I haven't test it all. I am working on the integration test but they don't yet pass.

        patch-MNG-2293.diff the patch

        patch-MNG-2293-source2.tar.bz2 the test files to add to the maven-plugin-tool-java plugin for the test to pass

        it0106.tar.bz2 the integration test, not yet finished.

        Sorry have to run, and not sure when I will have time to finish that

        Show
        Jerome Lacoste added a comment - This is a tentative patch, meaning that I haven't test it all. I am working on the integration test but they don't yet pass. patch- MNG-2293 .diff the patch patch- MNG-2293 -source2.tar.bz2 the test files to add to the maven-plugin-tool-java plugin for the test to pass it0106.tar.bz2 the integration test, not yet finished. Sorry have to run, and not sure when I will have time to finish that
        Hide
        Jerome Lacoste added a comment -

        I must have forgotten something:

        the plugin.xml generated for org.apache.maven.plugin.coreit.ParameterImplementationMojo doesn't contain anything related to the specified implementation for the bla field. Nothing related to MyBla in the file...

        Show
        Jerome Lacoste added a comment - I must have forgotten something: the plugin.xml generated for org.apache.maven.plugin.coreit.ParameterImplementationMojo doesn't contain anything related to the specified implementation for the bla field. Nothing related to MyBla in the file...
        Hide
        Jerome Lacoste added a comment -

        In case someone takes the patch. another thing that was missing was that the serializer lacked the 2-3 lines of code required to get the

        <implementation> </implementation>

        element in the <parameter> section of the <plugin>. See maven-plugin-descriptor module. Not sure if that is sufficient to fix completely the issue.

        Show
        Jerome Lacoste added a comment - In case someone takes the patch. another thing that was missing was that the serializer lacked the 2-3 lines of code required to get the <implementation> </implementation> element in the <parameter> section of the <plugin>. See maven-plugin-descriptor module. Not sure if that is sufficient to fix completely the issue.
        Hide
        Jerome Lacoste added a comment -

        I've updated the patch. Here's the updated status:

        • the patch still applies to the 2.1-SNAPSHOT branch
        • the patch contains all changes into one file as I've now discovered that svn add works for non committers...
        • I also have a small change for the plugin-plugin so that it reuses the latest maven-components
        • I've changed a couple of dependencies to try to force the correct libs to be used. Would appreciate if someone could review I did that in the correct place.
        • I've made sure that the generated plugin.xml file for the integration-tests/maven-core-it-plugin project now contains the <implementation> as it should:

        <parameters>
        <parameter>
        <name>bla</name>
        <type>org.apache.maven.plugin.coreit.Bla</type>
        <implementation>org.apache.maven.plugin.coreit.sub.MyBla</implementation>

        • unfortunately I wasn't able to make my integration test work, but I believe this is due to a different problem as I've had issues to make sure the correct plexus library (the one implementating PLX-219) is used. See dependency-mistery.log

        Now my questions:

        • can someone help me troubleshoot the issue in dependency-mistery.log ?
        • can someone let me know wether this is a candidate for maven2.0.x branch and if it could be backported once it works?
        Show
        Jerome Lacoste added a comment - I've updated the patch. Here's the updated status: the patch still applies to the 2.1-SNAPSHOT branch the patch contains all changes into one file as I've now discovered that svn add works for non committers... I also have a small change for the plugin-plugin so that it reuses the latest maven-components I've changed a couple of dependencies to try to force the correct libs to be used. Would appreciate if someone could review I did that in the correct place. I've made sure that the generated plugin.xml file for the integration-tests/maven-core-it-plugin project now contains the <implementation> as it should: <parameters> <parameter> <name>bla</name> <type>org.apache.maven.plugin.coreit.Bla</type> <implementation>org.apache.maven.plugin.coreit.sub.MyBla</implementation> unfortunately I wasn't able to make my integration test work, but I believe this is due to a different problem as I've had issues to make sure the correct plexus library (the one implementating PLX-219) is used. See dependency-mistery.log Now my questions: can someone help me troubleshoot the issue in dependency-mistery.log ? can someone let me know wether this is a candidate for maven2.0.x branch and if it could be backported once it works?
        Hide
        Jerome Lacoste added a comment -

        The issue related to plexus-containers-default was that M2_HOME/core ships alpha-9.
        I am rebuilding with forcing this to be alpha-10. Hope that will solve it.

        Show
        Jerome Lacoste added a comment - The issue related to plexus-containers-default was that M2_HOME/core ships alpha-9. I am rebuilding with forcing this to be alpha-10. Hope that will solve it.
        Hide
        Jerome Lacoste added a comment -

        This patch appears to be working. I hope I created the patch correctly as I have other changes in my tree and this one is the last in the stack. Will refresh it if it's not OK.

        Show
        Jerome Lacoste added a comment - This patch appears to be working. I hope I created the patch correctly as I have other changes in my tree and this one is the last in the stack. Will refresh it if it's not OK.
        Hide
        Kenney Westerhof added a comment -

        Reviewed the latest patch and ran a complete bootstrap to verify integration tests.

        As far as I can see it does NOT depend on MNG-2352.

        Committed in revision 413054.

        Show
        Kenney Westerhof added a comment - Reviewed the latest patch and ran a complete bootstrap to verify integration tests. As far as I can see it does NOT depend on MNG-2352 . Committed in revision 413054.
        Hide
        Jerome Lacoste added a comment -

        I don't get why it doesn't depend on the other issue as PLX-219 went
        into plexus alpha-10-SNAPSHOT. Could there be some local repository caching issue of
        some sort?

        Show
        Jerome Lacoste added a comment - I don't get why it doesn't depend on the other issue as PLX-219 went into plexus alpha-10-SNAPSHOT. Could there be some local repository caching issue of some sort?
        Hide
        Jerome Lacoste added a comment -

        I removed link to MNG-2352 as Kenney found out it wasn't dependent on it. Don't get it as PLX-219 made it in alpha-10. So maybe PLX-219 wasn't a blocker neither?

        Show
        Jerome Lacoste added a comment - I removed link to MNG-2352 as Kenney found out it wasn't dependent on it. Don't get it as PLX-219 made it in alpha-10. So maybe PLX-219 wasn't a blocker neither?
        Hide
        Jerome Lacoste added a comment -

        I believe this has not been properly fixed. I am now working on MWEBSTART-18 using maven 2.0.5 and maven doesn't add the default <implementation> to the generated plugin.xml file. Maybe my integration test was incorrect which led Kenney to think that MNG-2352 was not a blocker ?

        In the end, I think we need to make sure that the fix for PLX-219 is used by maven. Will try to trouble shoot the issue.

        Show
        Jerome Lacoste added a comment - I believe this has not been properly fixed. I am now working on MWEBSTART-18 using maven 2.0.5 and maven doesn't add the default <implementation> to the generated plugin.xml file. Maybe my integration test was incorrect which led Kenney to think that MNG-2352 was not a blocker ? In the end, I think we need to make sure that the fix for PLX-219 is used by maven. Will try to trouble shoot the issue.
        Hide
        Kenney Westerhof added a comment -

        Added a comment to MWEBSTART-18. I think the invalid use of 'implementation="$

        {....}

        " is what's causing this error.
        As far as I can see, the implementation attribute works properly in 2.0.5.

        Show
        Kenney Westerhof added a comment - Added a comment to MWEBSTART-18. I think the invalid use of 'implementation="$ {....} " is what's causing this error. As far as I can see, the implementation attribute works properly in 2.0.5.
        Hide
        Dennis Lundberg added a comment -

        For this to work you also need new versions of maven-plugin-tools (2.1) and maven-plugin-plugin (2.3). I'm currently pushing to release theses on the dev list. If the votes go well they should be available within a week.

        Show
        Dennis Lundberg added a comment - For this to work you also need new versions of maven-plugin-tools (2.1) and maven-plugin-plugin (2.3). I'm currently pushing to release theses on the dev list. If the votes go well they should be available within a week.

          People

          • Assignee:
            kenneyw
            Reporter:
            Jerome Lacoste
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development