protected MavenProject getMavenProject()

in src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java [168:186]


    protected MavenProject getMavenProject(String artifactString) throws MojoExecutionException {
        try {
            ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
            pbr.setRemoteRepositories(project.getRemoteArtifactRepositories());
            pbr.setPluginArtifactRepositories(project.getPluginArtifactRepositories());
            pbr.setProject(null);
            pbr.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
            pbr.setResolveDependencies(true);

            org.eclipse.aether.artifact.Artifact artifact =
                    resolveArtifact(getAetherArtifact(artifactString, "pom")).getArtifact();

            return projectBuilder.build(artifact.getFile(), pbr).getProject();
        } catch (Exception e) {
            throw new MojoExecutionException(
                    "Unable to get the POM for the artifact '" + artifactString + "'. Verify the artifact parameter.",
                    e);
        }
    }