public static Model cloneModel( Model model )
{
// TODO: would be nice for the modello:java code to generate this as a copy constructor
Model newModel = new Model();
ModelInheritanceAssembler assembler = new DefaultModelInheritanceAssembler();
newModel.setModelVersion( model.getModelVersion() );
newModel.setName( model.getName() );
newModel.setParent( cloneParent( model.getParent() ) );
newModel.setVersion( model.getVersion() );
newModel.setArtifactId( model.getArtifactId() );
newModel.setProperties( new Properties( model.getProperties() ) );
newModel.setGroupId( model.getGroupId() );
newModel.setPackaging( model.getPackaging() );
newModel.setModules( cloneModules( model.getModules() ) );
newModel.setProfiles( cloneProfiles( model.getProfiles() ) );
assembler.copyModel( newModel, model );
return newModel;
}