Search in sources :

Example 1 with ModelBuilder

use of org.apache.maven.model.building.ModelBuilder in project buck by facebook.

the class Pom method constructModel.

private Model constructModel(File file, Model model) {
    ModelBuilder modelBuilder = MODEL_BUILDER_FACTORY.newInstance();
    try {
        ModelBuildingRequest req = new DefaultModelBuildingRequest().setPomFile(file);
        ModelBuildingResult modelBuildingResult = modelBuilder.build(req);
        Model constructed = Preconditions.checkNotNull(modelBuildingResult.getRawModel());
        return merge(model, constructed);
    } catch (ModelBuildingException e) {
        throw new RuntimeException(e);
    }
}
Also used : ModelBuilder(org.apache.maven.model.building.ModelBuilder) ModelBuildingRequest(org.apache.maven.model.building.ModelBuildingRequest) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) ModelBuildingResult(org.apache.maven.model.building.ModelBuildingResult) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) Model(org.apache.maven.model.Model) ModelBuildingException(org.apache.maven.model.building.ModelBuildingException)

Aggregations

Model (org.apache.maven.model.Model)1 DefaultModelBuildingRequest (org.apache.maven.model.building.DefaultModelBuildingRequest)1 ModelBuilder (org.apache.maven.model.building.ModelBuilder)1 ModelBuildingException (org.apache.maven.model.building.ModelBuildingException)1 ModelBuildingRequest (org.apache.maven.model.building.ModelBuildingRequest)1 ModelBuildingResult (org.apache.maven.model.building.ModelBuildingResult)1