rfscholte commented on a change in pull request #286: [MNG-6656] Introduce base 
for build/consumer process
URL: https://github.com/apache/maven/pull/286#discussion_r335149584
 
 

 ##########
 File path: 
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
 ##########
 @@ -733,12 +758,81 @@ private void checkPluginVersions( List<ModelData> 
lineage, ModelBuildingRequest
     private void assembleInheritance( List<ModelData> lineage, 
ModelBuildingRequest request,
                                       ModelProblemCollector problems )
     {
-        for ( int i = lineage.size() - 2; i >= 0; i-- )
+        for ( int i = lineage.size() - 2; i >= 1; i-- )
         {
             Model parent = lineage.get( i + 1 ).getModel();
             Model child = lineage.get( i ).getModel();
             inheritanceAssembler.assembleModelInheritance( child, parent, 
request, problems );
         }
+        
+        // re-read model from file
+        if ( Boolean.getBoolean( "maven.experimental.buildconsumer" ) && 
request.isTransformPom() )
+        {
+            try
+            {
+                // TODO: parent might be part of reactor... better read all 
lineage items like this?
+                Model parent = lineage.get( 1 ).getModel();
+                
+                Model child = modelProcessor.read( transformData( lineage.get( 
0 ) ), null );
+                inheritanceAssembler.assembleModelInheritance( child, parent, 
request, problems );
+
+                // sync pomfile, is transient
+                child.setPomFile( lineage.get( 0 ).getModel().getPomFile() );
+                // overwrite child
+                lineage.get( 0 ).setModel( child );
+            }
+            catch ( IOException | TransformException | SAXException | 
ParserConfigurationException e )
+            {
+                // this is second read, should not happen
+                e.printStackTrace();
 
 Review comment:
   This has been replaced. I noticed that the ModelBuilder doesn't contain a 
dependency on a logging framework. Assuming the modelbuilder artifact is used 
by other tools too, I can imagine that logging here is not preferred. Instead 
the ProblemCollector should be used.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to