You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/14 09:50:21 UTC

[GitHub] [maven] gnodet opened a new pull request, #828: Fix site generation

gnodet opened a new pull request, #828:
URL: https://github.com/apache/maven/pull/828

   Fix site generation using 4.0.0-alpha-1.
   It is currently broken because the report plugins are badly merged.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] michael-o commented on a diff in pull request #828: Fix site generation

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #828:
URL: https://github.com/apache/maven/pull/828#discussion_r995582438


##########
maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java:
##########
@@ -337,7 +337,7 @@ protected void mergeReporting_Plugins( Reporting.Builder builder,
                     if ( element.isInherited() )
                     {
                         // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions as well
-                        ReportPlugin plugin = ReportPlugin.newInstance();
+                        ReportPlugin plugin = ReportPlugin.newInstance( false );

Review Comment:
   Why does this make a difference?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet merged pull request #828: Fix site generation

Posted by GitBox <gi...@apache.org>.
gnodet merged PR #828:
URL: https://github.com/apache/maven/pull/828


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven] gnodet commented on a diff in pull request #828: Fix site generation

Posted by GitBox <gi...@apache.org>.
gnodet commented on code in PR #828:
URL: https://github.com/apache/maven/pull/828#discussion_r995672029


##########
maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java:
##########
@@ -337,7 +337,7 @@ protected void mergeReporting_Plugins( Reporting.Builder builder,
                     if ( element.isInherited() )
                     {
                         // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions as well
-                        ReportPlugin plugin = ReportPlugin.newInstance();
+                        ReportPlugin plugin = ReportPlugin.newInstance( false );

Review Comment:
   Here's the generated code for the `newInstance()` methods:
   ```
       /**
        * Creates a new {@code ReportPlugin} instance.
        * Equivalent to {@code newInstance( true )}.
        * @see #newInstance(boolean)
        *
        * @return a new {@code ReportPlugin}
        */
       @Nonnull
       public static ReportPlugin newInstance()
       {
           return newInstance( true );
       }
   
       /**
        * Creates a new {@code ReportPlugin} instance using default values or not.
        * Equivalent to {@code newBuilder( withDefaults ).build()}.
        *
        * @param withDefaults the boolean indicating whether default values should be used
        * @return a new {@code ReportPlugin}
        */
       @Nonnull
       public static ReportPlugin newInstance( boolean withDefaults )
       {
           return newBuilder( withDefaults ).build();
       }
   ```
   
   The default values comes from the model.  By default the `groupId` has the value `org.apache.maven.plugins`.
   
   In the v3 model, we had [the following](https://github.com/apache/maven/blob/maven-3.9.x/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java#L338-L341) instead:
   ```
                           ReportPlugin plugin = new ReportPlugin();
                           plugin.setLocation( "", element.getLocation( "" ) );
                           plugin.setGroupId( null );
                           mergeReportPlugin( plugin, element, sourceDominant, context );
   ```
   The problem is that the call to `plugin.setGroupId( null )` had been missed during the apiv4 merge.  The use of the `newInstance( false )` forces to not use default values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org