mthmulders commented on a change in pull request #321: [MNG-5669] same pom.xml is read multiple times URL: https://github.com/apache/maven/pull/321#discussion_r371626459
########## File path: maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java ########## @@ -627,9 +644,71 @@ private Model readModel( ModelSource modelSource, File pomFile, ModelBuildingReq throw problems.newModelBuildingException(); } + if ( pomFile != null ) + { + putCache( request.getModelCache(), modelSource, ModelCacheTag.FILEMODEL, model ); + } + + String groupId = getGroupId( model ); + String artifactId = model.getArtifactId(); + String version = getVersion( model ); + + ModelData modelData = new ModelData( modelSource, model, groupId, artifactId, version ); + putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW, modelData ); + return model; } + private Model getModelFromCache( ModelSource modelSource, ModelCache cache ) + { + Model model; + if ( modelSource instanceof ArtifactModelSource ) + { + ArtifactModelSource artifactModelSource = ( ArtifactModelSource ) modelSource; + ModelData modelData = getCache( cache, artifactModelSource.getGroupId(), Review comment: The method name `getCache` suggests that it returns a cache. But one of its parameters is _named_ "cache" and it returns a `ModelData` instance. Does the name `getCache` match with what the method does? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services