All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.project.builder.PomClassicDomainModelFactory Maven / Gradle / Ivy

Go to download

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 );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy