private void assembleDistributionInheritence( Model child, Model parent, String childPathAdjustment,
boolean appendPaths )
{
if ( parent.getDistributionManagement() != null )
{
DistributionManagement parentDistMgmt = parent.getDistributionManagement();
DistributionManagement childDistMgmt = child.getDistributionManagement();
if ( childDistMgmt == null )
{
childDistMgmt = new DistributionManagement();
child.setDistributionManagement( childDistMgmt );
}
if ( childDistMgmt.getSite() == null )
{
if ( parentDistMgmt.getSite() != null )
{
Site site = new Site();
childDistMgmt.setSite( site );
site.setId( parentDistMgmt.getSite().getId() );
site.setName( parentDistMgmt.getSite().getName() );
site.setUrl( parentDistMgmt.getSite().getUrl() );
if ( site.getUrl() != null )
{
site.setUrl(
appendPath( site.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
}
}
}
if ( childDistMgmt.getRepository() == null )
{
if ( parentDistMgmt.getRepository() != null )
{
DeploymentRepository repository = copyDistributionRepository( parentDistMgmt.getRepository() );
childDistMgmt.setRepository( repository );
}
}
if ( childDistMgmt.getSnapshotRepository() == null )
{
if ( parentDistMgmt.getSnapshotRepository() != null )
{
DeploymentRepository repository =
copyDistributionRepository( parentDistMgmt.getSnapshotRepository() );
childDistMgmt.setSnapshotRepository( repository );
}
}
if ( StringUtils.isEmpty( childDistMgmt.getDownloadUrl() ) )
{
childDistMgmt.setDownloadUrl( parentDistMgmt.getDownloadUrl() );
}
// NOTE: We SHOULD NOT be inheriting status, since this is an assessment of the POM quality.
// NOTE: We SHOULD NOT be inheriting relocation, since this relates to a single POM
}