Search in sources :

Example 1 with ProjectDependencyAnalyzer

use of org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer in project maven-plugins by apache.

the class AbstractAnalyzeMojo method createProjectDependencyAnalyzer.

protected ProjectDependencyAnalyzer createProjectDependencyAnalyzer() throws MojoExecutionException {
    final String role = ProjectDependencyAnalyzer.ROLE;
    final String roleHint = analyzer;
    try {
        final PlexusContainer container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
        return (ProjectDependencyAnalyzer) container.lookup(role, roleHint);
    } catch (Exception exception) {
        throw new MojoExecutionException("Failed to instantiate ProjectDependencyAnalyser with role " + role + " / role-hint " + roleHint, exception);
    }
}
Also used : PlexusContainer(org.codehaus.plexus.PlexusContainer) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ProjectDependencyAnalyzer(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer) ProjectDependencyAnalyzerException(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException) ContextException(org.codehaus.plexus.context.ContextException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Example 2 with ProjectDependencyAnalyzer

use of org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer in project maven-dependency-plugin by apache.

the class AbstractAnalyzeMojo method createProjectDependencyAnalyzer.

/**
 * @return {@link ProjectDependencyAnalyzer}
 * @throws MojoExecutionException in case of an error.
 */
protected ProjectDependencyAnalyzer createProjectDependencyAnalyzer() throws MojoExecutionException {
    final String role = ProjectDependencyAnalyzer.ROLE;
    final String roleHint = analyzer;
    try {
        final PlexusContainer container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
        return (ProjectDependencyAnalyzer) container.lookup(role, roleHint);
    } catch (Exception exception) {
        throw new MojoExecutionException("Failed to instantiate ProjectDependencyAnalyser with role " + role + " / role-hint " + roleHint, exception);
    }
}
Also used : PlexusContainer(org.codehaus.plexus.PlexusContainer) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ProjectDependencyAnalyzer(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer) ProjectDependencyAnalyzerException(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException) ContextException(org.codehaus.plexus.context.ContextException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 MojoFailureException (org.apache.maven.plugin.MojoFailureException)2 ProjectDependencyAnalyzer (org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer)2 ProjectDependencyAnalyzerException (org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException)2 PlexusContainer (org.codehaus.plexus.PlexusContainer)2 ContextException (org.codehaus.plexus.context.ContextException)2