org.apache.maven.project.builder.PomClassicDomainModelFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-project Show documentation
Show all versions of maven-project Show documentation
This library is used to not only read Maven project object model files, but to assemble inheritence
and to retrieve remote models as required.
The newest version!
package org.apache.maven.project.builder;
import org.apache.maven.shared.model.DomainModelFactory;
import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.ModelProperty;
import org.apache.maven.shared.model.ModelMarshaller;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.util.List;
import java.io.IOException;
import java.io.StringReader;
public class PomClassicDomainModelFactory implements DomainModelFactory
{
public DomainModel createDomainModel(List modelProperties) throws IOException
{
String xml = null;
try
{
xml = ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, ProjectUri.baseUri );
return new PomClassicDomainModel( new MavenXpp3Reader().read( new StringReader( xml ) ) );
}
catch ( XmlPullParserException e )
{
throw new IOException( e + ":\r\n" + xml );
}
}
}