1 package org.apache.maven.model.converter; 2 3 18 19 import org.apache.maven.model.Model; 20 import org.apache.maven.model.io.xpp3.MavenXpp3Reader; 21 import org.apache.maven.model.io.xpp3.MavenXpp3Writer; 22 23 import java.io.Reader ; 24 import java.io.Writer ; 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 31 public class V4PomRewriter 32 implements ArtifactPomRewriter 33 { 34 private ModelConverter translator; 35 36 public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version, 37 String packaging ) 38 throws Exception 39 { 40 Model model = null; 41 42 if ( from != null ) 43 { 44 MavenXpp3Reader reader = new MavenXpp3Reader(); 45 46 model = reader.read( from ); 47 } 48 else 49 { 50 model = new Model(); 51 } 52 53 if ( model != null ) 54 { 55 translator.validateV4Basics( model, groupId, artifactId, version, packaging ); 56 57 if ( !reportOnly ) 58 { 59 MavenXpp3Writer writer = new MavenXpp3Writer(); 60 writer.write( to, model ); 61 } 62 } 63 } 64 65 public List getWarnings() 66 { 67 return translator.getWarnings(); 68 } 69 } | Popular Tags |