Source:
private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest request, DefaultModelProblemCollector problems ) throws ModelBuildingException { ModelData parentData; Parent parent = childModel.getParent(); if ( parent != null ) { String groupId = parent.getGroupId(); String artifactId = parent.getArtifactId(); String version = parent.getVersion(); parentData = getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW ); if ( parentData == null ) { parentData = readParentLocally( childModel, childSource, request, problems ); if ( parentData == null ) { parentData = readParentExternally( childModel, request, problems ); } putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW, parentData ); } else { File pomFile = parentData.getModel().getPomFile(); if ( pomFile != null ) { FileModelSource pomFileModel = new FileModelSource( pomFile ); ModelSource expectedParentSource = getParentPomFile( childModel, childSource ); if ( expectedParentSource == null || ( expectedParentSource instanceof ModelSource2 && !pomFileModel.equals( expectedParentSource ) ) ) { parentData = readParentExternally( childModel, request, problems ); } } } Model parentModel = parentData.getModel(); if ( !"pom".equals( parentModel.getPackaging() ) ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel ) + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" ) .setLocation( parentModel.getLocation( "packaging" ) ) ); } } else { parentData = null; } return parentData; }

Target:
private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest request, DefaultModelProblemCollector problems ) throws ModelBuildingException { ModelData parentData; Parent parent = childModel.getParent(); if ( parent != null ) { String groupId = parent.getGroupId(); String artifactId = parent.getArtifactId(); String version = parent.getVersion(); parentData = getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW ); if ( parentData == null ) { parentData = readParentLocally( childModel, childSource, request, problems ); if ( parentData == null ) { parentData = readParentExternally( childModel, request, problems ); } putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW, parentData ); } else { File pomFile = parentData.getModel().getPomFile(); if ( pomFile != null ) { FileModelSource pomSource = new FileModelSource( pomFile ); ModelSource expectedParentSource = getParentPomFile( childModel, childSource ); if ( expectedParentSource == null || ( expectedParentSource instanceof ModelSource2 && !pomSource.equals( expectedParentSource ) ) ) { parentData = readParentExternally( childModel, request, problems ); } } } Model parentModel = parentData.getModel(); if ( !"pom".equals( parentModel.getPackaging() ) ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel ) + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" ) .setLocation( parentModel.getLocation( "packaging" ) ) ); } } else { parentData = null; } return parentData; }