Update releasePom fields only if fields are null

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@280545 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-09-13 12:14:53 +00:00
parent 8e47a7e719
commit d72b1ae50c
1 changed files with 49 additions and 10 deletions

View File

@ -974,16 +974,55 @@ public class PrepareReleaseMojo
private void fixNullValueInModel( Model modelToFix, Model correctModel )
{
modelToFix.setModelVersion( correctModel.getModelVersion() );
modelToFix.setName( correctModel.getName() );
modelToFix.setParent( cloneParent( correctModel.getParent() ) );
modelToFix.setVersion( correctModel.getVersion() );
modelToFix.setArtifactId( correctModel.getArtifactId() );
modelToFix.setProperties( new Properties( correctModel.getProperties() ) );
modelToFix.setGroupId( correctModel.getGroupId() );
modelToFix.setPackaging( correctModel.getPackaging() );
modelToFix.setModules( cloneModules( correctModel.getModules() ) );
modelToFix.setDistributionManagement( correctModel.getDistributionManagement() );
if ( modelToFix.getModelVersion() != null )
{
modelToFix.setModelVersion( correctModel.getModelVersion() );
}
if ( modelToFix.getName() != null )
{
modelToFix.setName( correctModel.getName() );
}
if ( modelToFix.getParent() != null )
{
modelToFix.setParent( cloneParent( correctModel.getParent() ) );
}
if ( modelToFix.getVersion() != null )
{
modelToFix.setVersion( correctModel.getVersion() );
}
if ( modelToFix.getArtifactId() != null )
{
modelToFix.setArtifactId( correctModel.getArtifactId() );
}
if ( modelToFix.getProperties() != null && modelToFix.getProperties().isEmpty() )
{
modelToFix.setProperties( new Properties( correctModel.getProperties() ) );
}
if ( modelToFix.getGroupId() != null )
{
modelToFix.setGroupId( correctModel.getGroupId() );
}
if ( modelToFix.getPackaging() != null )
{
modelToFix.setPackaging( correctModel.getPackaging() );
}
if ( modelToFix.getModules() != null && !modelToFix.getModules().isEmpty() )
{
modelToFix.setModules( cloneModules( correctModel.getModules() ) );
}
if ( modelToFix.getDistributionManagement() != null )
{
modelToFix.setDistributionManagement( correctModel.getDistributionManagement() );
}
}
private static List cloneModules( List modules )