Maven 2 & 3

MavenEmbedder.writeModel( w, model) should allow to preserve xml formatting