From df59dabb75e851d23b0a4f86e1e8765918f0f293 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Fri, 30 Sep 2005 16:46:59 +0000 Subject: [PATCH] o adding model writer for eu git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@292812 13f79535-47bb-0310-9956-ffa450edef68 --- maven-embedder/notes.txt | 3 +++ .../org/apache/maven/embedder/MavenEmbedder.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/maven-embedder/notes.txt b/maven-embedder/notes.txt index 192a172c2a..1c3afb010d 100644 --- a/maven-embedder/notes.txt +++ b/maven-embedder/notes.txt @@ -64,3 +64,6 @@ plugin registry and settings should be stored in the tool specific locations -- properties param on execute() method -- transfet listener and loggers, system out cleanup + + one more thing I need in embedder - writeModel() method + diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java index 067eb7a3f4..2b02cb354f 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java @@ -24,6 +24,7 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.apache.maven.profiles.ProfileManager; import org.apache.maven.profiles.DefaultProfileManager; import org.apache.maven.project.MavenProject; @@ -61,6 +62,7 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.InputStream; +import java.io.Writer; import java.util.List; import java.util.ArrayList; import java.util.Iterator; @@ -95,6 +97,8 @@ public class MavenEmbedder private MavenXpp3Reader modelReader; + private MavenXpp3Writer modelWriter; + private ProfileManager profileManager; private PluginDescriptorBuilder pluginDescriptorBuilder; @@ -242,6 +246,12 @@ public class MavenEmbedder return modelReader.read( new FileReader( model ) ); } + public void writeModel( Writer writer, Model model ) + throws IOException + { + modelWriter.write( writer, model ); + } + // ---------------------------------------------------------------------- // Project // ---------------------------------------------------------------------- @@ -517,6 +527,8 @@ public class MavenEmbedder modelReader = new MavenXpp3Reader(); + modelWriter = new MavenXpp3Writer(); + pluginDescriptorBuilder = new PluginDescriptorBuilder(); profileManager = new DefaultProfileManager( embedder.getContainer() );