-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDEP-862] Get rid of plexus-container-default from dependencies
- Loading branch information
1 parent
b4474bb
commit 2992497
Showing
2 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,16 +35,15 @@ | |
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.Component; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.project.MavenProject; | ||
import org.apache.maven.shared.artifact.filter.StrictPatternExcludesArtifactFilter; | ||
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis; | ||
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer; | ||
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException; | ||
import org.codehaus.plexus.PlexusConstants; | ||
import org.codehaus.plexus.PlexusContainer; | ||
import org.codehaus.plexus.context.Context; | ||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; | ||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; | ||
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; | ||
|
||
/** | ||
|
@@ -54,14 +53,15 @@ | |
* @author <a href="mailto:[email protected]">Mark Hobson</a> | ||
* @since 2.0-alpha-5 | ||
*/ | ||
public abstract class AbstractAnalyzeMojo extends AbstractMojo implements Contextualizable { | ||
public abstract class AbstractAnalyzeMojo extends AbstractMojo { | ||
// fields ----------------------------------------------------------------- | ||
|
||
/** | ||
* The plexus context to look-up the right {@link ProjectDependencyAnalyzer} implementation depending on the mojo | ||
* The plexusContainer to look-up the right {@link ProjectDependencyAnalyzer} implementation depending on the mojo | ||
* configuration. | ||
*/ | ||
private Context context; | ||
@Component | ||
private PlexusContainer plexusContainer; | ||
|
||
/** | ||
* The Maven project to analyze. | ||
|
@@ -300,20 +300,15 @@ public void execute() throws MojoExecutionException, MojoFailureException { | |
* @throws MojoExecutionException in case of an error. | ||
*/ | ||
protected ProjectDependencyAnalyzer createProjectDependencyAnalyzer() throws MojoExecutionException { | ||
|
||
try { | ||
final PlexusContainer container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY); | ||
return container.lookup(ProjectDependencyAnalyzer.class, analyzer); | ||
} catch (Exception exception) { | ||
return plexusContainer.lookup(ProjectDependencyAnalyzer.class, analyzer); | ||
} catch (ComponentLookupException exception) { | ||
throw new MojoExecutionException( | ||
"Failed to instantiate ProjectDependencyAnalyser" + " / role-hint " + analyzer, exception); | ||
} | ||
} | ||
|
||
@Override | ||
public void contextualize(Context theContext) { | ||
this.context = theContext; | ||
} | ||
|
||
/** | ||
* @return {@link #skip} | ||
*/ | ||
|