Maven Site Plugin
  1. Maven Site Plugin
  2. MSITE-484

Support adding and overriding report plugins in new maven-site-plugin 3.x reportPlugins configuration format

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0-beta-1, 3.0-beta-2, 3.0-beta-3, 3.3
    • Fix Version/s: backlog
    • Component/s: inheritance, Maven 3
    • Labels:
      None
    • Environment:
      3.0-beta-1-SNAPSHOT
    • Number of attachments :
      3

      Description

      When using the new configuration format for reportPlugins, it appears that there's no way to:

      • Add a report plugin to a submodule
      • Override the configuration of a report plugin in a submodule

      Using the old <reporting> section, both of these use cases were supported. For large, multi-module builds, it is problematic having to respecify all reporting plugins in any submodule pom that needs to either add an additional reporting plugin or change the configuration of a reporting plugin.

      Attached is a sample project that has a parent POM configured with project-info-reports and javadoc plugin and a submodule configured with jxr plugin and javadoc plugin. The relevant output is here:

      [INFO] ------------------------------------------------------------------------
      [INFO] Building parent 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ parent ---
      [INFO] Deleting file set: /Users/mpilquist/Downloads/site-parent-issue/target (included: [**], excluded: [])
      [INFO] 
      [INFO] --- maven-site-plugin:3.0-beta-1-SNAPSHOT:site (default-site) @ parent ---
      [INFO] configuring reportPlugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.2
      [INFO] configuring reportPlugin org.apache.maven.plugins:maven-javadoc-plugin:2.6.1
      ...
      [INFO] ------------------------------------------------------------------------
      [INFO] Building parent-usage-test 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ parent-usage-test ---
      [INFO] 
      [INFO] --- maven-site-plugin:3.0-beta-1-SNAPSHOT:site (default-site) @ parent-usage-test ---
      [INFO] configuring reportPlugin org.apache.maven.plugins:maven-jxr-plugin:2.1
      [INFO] configuring reportPlugin org.apache.maven.plugins:maven-javadoc-plugin:2.6.1
      

      Looking at the maven-site-plugin code, it appears the the reportPlugins parameter is just a regular array parameter. AFAIK, there's no way to merge list configuration items. Other plugins have worked around this by defining additional mojo parameters (e.g., maven-eclipse-plugin and buildCommands / additionalBuildCommands – http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html). This isn't the most flexible option though as it only solves 1 level inheritance.

        Issue Links

          Activity

          Hide
          Olivier Lamy added a comment -

          looks interesting patch. Could you please fix license header and use correct ASF attribution (I see :"....Licensed to Jasig...." )

          Show
          Olivier Lamy added a comment - looks interesting patch. Could you please fix license header and use correct ASF attribution (I see :"....Licensed to Jasig...." )
          Hide
          Eric Dalquist added a comment -

          I just realized the patch is incomplete, I'll get the final version posted tomorrow.

          Show
          Eric Dalquist added a comment - I just realized the patch is incomplete, I'll get the final version posted tomorrow.
          Hide
          Andreas Sewe added a comment -

          FWIW, it would be great if the mergePolicy.children and mergePolicy.removeDuplicates attributes (and also combine.children) could finally become part of the POM's XML Schema: http://maven.apache.org/xsd/maven-4.0.0.xsd. It's quite annoying to see validation errors on elements like developers, which would benefit from this feature and are specified by the XSD (unlike, e.g., the plugins' configuration which is xsd:any), because these attributes are not part of the XSD.

          On a related note: Why not use XML Namespaces for mergePolicy.*? Verbosity can't be the only reason; after all, it's one xmlns declaration + a short prefix like mp vs. the longer mergePolicy on every attribute.

          Show
          Andreas Sewe added a comment - FWIW, it would be great if the mergePolicy.children and mergePolicy.removeDuplicates attributes (and also combine.children ) could finally become part of the POM's XML Schema: http://maven.apache.org/xsd/maven-4.0.0.xsd . It's quite annoying to see validation errors on elements like developers , which would benefit from this feature and are specified by the XSD (unlike, e.g., the plugins' configuration which is xsd:any ), because these attributes are not part of the XSD. On a related note: Why not use XML Namespaces for mergePolicy.* ? Verbosity can't be the only reason; after all, it's one xmlns declaration + a short prefix like mp vs. the longer mergePolicy on every attribute.
          Hide
          Eric Dalquist added a comment -

          Updated patch, replaces mergePolicy. prefix with merge: xml namespace. In my testing you can specify whatever you want for the namespace URI since I don't actually have an XSD to go with it, I used xmlns:merge="http://maven.apache.org/plugin-merge" in my test pom.

          This patch should be complete, all integration tests pass and the copyright headers are correct. I do have an Apache ICLA on file and am an active committer in the portals project: http://people.apache.org/committer-index.html

          I would love this to become a core feature of Maven itself for merging plugin configurations. I'm not sure where to go with getting that requested as a feature. I'm hoping that this this seems to affect the site plugin more than others it would be faster to get the fix in here so it could be used as soon as possible.

          Show
          Eric Dalquist added a comment - Updated patch, replaces mergePolicy. prefix with merge: xml namespace. In my testing you can specify whatever you want for the namespace URI since I don't actually have an XSD to go with it, I used xmlns:merge="http://maven.apache.org/plugin-merge" in my test pom. This patch should be complete, all integration tests pass and the copyright headers are correct. I do have an Apache ICLA on file and am an active committer in the portals project: http://people.apache.org/committer-index.html I would love this to become a core feature of Maven itself for merging plugin configurations. I'm not sure where to go with getting that requested as a feature. I'm hoping that this this seems to affect the site plugin more than others it would be faster to get the fix in here so it could be used as soon as possible.
          Hide
          Herve Boutemy added a comment -

          I didn't have time to check for the moment, but yes, this seems interesting at Maven core level: there have already been discussion about having more flexible merge policy for some pom content
          see MNG-3124 and MNG-2807

          Show
          Herve Boutemy added a comment - I didn't have time to check for the moment, but yes, this seems interesting at Maven core level: there have already been discussion about having more flexible merge policy for some pom content see MNG-3124 and MNG-2807

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              Michael Pilquist
            • Votes:
              44 Vote for this issue
              Watchers:
              41 Start watching this issue

              Dates

              • Created:
                Updated: