Example usage for org.apache.maven.project.validation ModelValidationResult render

List of usage examples for org.apache.maven.project.validation ModelValidationResult render

Introduction

In this page you can find the example usage for org.apache.maven.project.validation ModelValidationResult render.

Prototype

public String render(String indentation) 

Source Link

Usage

From source file:lu.softec.maven.mavenizer.mavenfile.internal.DefaultMavenFileFactory.java

License:Open Source License

/**
 * Validate coordinates of a {@link MavenFile} using the {@link ModelValidator}
 *
 * @param file {@link MavenFile} to be validated
 * @throws InvalidMavenCoordinatesException when validation fails
 *///from   w w  w. java 2 s .  c  o m
private void validateArtifactInformation(MavenFile file) throws InvalidMavenCoordinatesException {
    Model model = file.getMinimalModel();

    ModelValidationResult result = modelValidator.validate(model);

    if (result.getMessageCount() > 0) {
        throw new InvalidMavenCoordinatesException(
                "Coordinates are incomplete or not valid:\n" + result.render("  "));
    }
}

From source file:net.md_5.specialsource.mavenplugin.InstallRemappedFileMojo.java

License:Apache License

/**
 * Validates the user-supplied artifact information.
 *
 * @throws MojoExecutionException If any artifact coordinate is invalid.
 *//*from  w  w w . j ava2  s.  c o m*/
private void validateArtifactInformation() throws MojoExecutionException {
    Model model = generateModel();

    ModelValidationResult result = modelValidator.validate(model);

    if (result.getMessageCount() > 0) {
        throw new MojoExecutionException(
                "The artifact information is incomplete or not valid:\n" + result.render("  "));
    }
}