Search in sources :

Example 1 with ModelProblemCollectorRequest

use of org.apache.maven.model.building.ModelProblemCollectorRequest in project spring-cloud-function by spring-cloud.

the class MavenSettings method createFailureMessage.

private String createFailureMessage(SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        printer.println("    " + problem.getMessage() + (problem.getLocation() != null ? " at " + problem.getLocation() : ""));
        if (problem.getException() != null) {
            printer.println(indentStackTrace(problem.getException(), "        "));
        }
    }
    return message.toString();
}
Also used : StringWriter(java.io.StringWriter) PrintWriter(java.io.PrintWriter) ModelProblemCollectorRequest(org.apache.maven.model.building.ModelProblemCollectorRequest)

Example 2 with ModelProblemCollectorRequest

use of org.apache.maven.model.building.ModelProblemCollectorRequest in project sts4 by spring-projects.

the class MavenBridge method interpolateModel.

public void interpolateModel(MavenProject project, Model model) throws MavenException {
    ModelBuildingRequest request = new DefaultModelBuildingRequest();
    request.setUserProperties(project.getProperties());
    ModelProblemCollector problems = new ModelProblemCollector() {

        @Override
        public void add(ModelProblemCollectorRequest req) {
        }
    };
    lookup(ModelInterpolator.class).interpolateModel(model, project.getBasedir(), request, problems);
}
Also used : ModelBuildingRequest(org.apache.maven.model.building.ModelBuildingRequest) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) ModelInterpolator(org.apache.maven.model.interpolation.ModelInterpolator) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) ModelProblemCollector(org.apache.maven.model.building.ModelProblemCollector) ModelProblemCollectorRequest(org.apache.maven.model.building.ModelProblemCollectorRequest)

Example 3 with ModelProblemCollectorRequest

use of org.apache.maven.model.building.ModelProblemCollectorRequest in project spring-boot by spring-projects.

the class MavenSettings method createFailureMessage.

private String createFailureMessage(SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        String location = (problem.getLocation() != null) ? " at " + problem.getLocation() : "";
        printer.println("    " + problem.getMessage() + location);
        if (problem.getException() != null) {
            printer.println(indentStackTrace(problem.getException(), "        "));
        }
    }
    return message.toString();
}
Also used : StringWriter(java.io.StringWriter) PrintWriter(java.io.PrintWriter) ModelProblemCollectorRequest(org.apache.maven.model.building.ModelProblemCollectorRequest)

Aggregations

ModelProblemCollectorRequest (org.apache.maven.model.building.ModelProblemCollectorRequest)3 PrintWriter (java.io.PrintWriter)2 StringWriter (java.io.StringWriter)2 DefaultModelBuildingRequest (org.apache.maven.model.building.DefaultModelBuildingRequest)1 ModelBuildingRequest (org.apache.maven.model.building.ModelBuildingRequest)1 ModelProblemCollector (org.apache.maven.model.building.ModelProblemCollector)1 ModelInterpolator (org.apache.maven.model.interpolation.ModelInterpolator)1