Skip to content

Commit 2992497

Browse files
[MDEP-862] Get rid of plexus-container-default from dependencies
1 parent b4474bb commit 2992497

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ under the License.
170170
<groupId>org.apache.maven.doxia</groupId>
171171
<artifactId>doxia-sink-api</artifactId>
172172
<version>1.11.1</version>
173+
<exclusions>
174+
<exclusion>
175+
<groupId>org.codehaus.plexus</groupId>
176+
<artifactId>plexus-container-default</artifactId>
177+
</exclusion>
178+
</exclusions>
173179
</dependency>
174180
<dependency>
175181
<groupId>org.apache.maven.reporting</groupId>
@@ -180,6 +186,12 @@ under the License.
180186
<groupId>org.apache.maven.reporting</groupId>
181187
<artifactId>maven-reporting-impl</artifactId>
182188
<version>3.2.0</version>
189+
<exclusions>
190+
<exclusion>
191+
<groupId>org.codehaus.plexus</groupId>
192+
<artifactId>plexus-container-default</artifactId>
193+
</exclusion>
194+
</exclusions>
183195
</dependency>
184196
<dependency>
185197
<groupId>commons-io</groupId>

src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
import org.apache.maven.plugin.AbstractMojo;
3636
import org.apache.maven.plugin.MojoExecutionException;
3737
import org.apache.maven.plugin.MojoFailureException;
38+
import org.apache.maven.plugins.annotations.Component;
3839
import org.apache.maven.plugins.annotations.Parameter;
3940
import org.apache.maven.project.MavenProject;
4041
import org.apache.maven.shared.artifact.filter.StrictPatternExcludesArtifactFilter;
4142
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
4243
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
4344
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
44-
import org.codehaus.plexus.PlexusConstants;
4545
import org.codehaus.plexus.PlexusContainer;
46-
import org.codehaus.plexus.context.Context;
47-
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
46+
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
4847
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
4948

5049
/**
@@ -54,14 +53,15 @@
5453
* @author <a href="mailto:[email protected]">Mark Hobson</a>
5554
* @since 2.0-alpha-5
5655
*/
57-
public abstract class AbstractAnalyzeMojo extends AbstractMojo implements Contextualizable {
56+
public abstract class AbstractAnalyzeMojo extends AbstractMojo {
5857
// fields -----------------------------------------------------------------
5958

6059
/**
61-
* The plexus context to look-up the right {@link ProjectDependencyAnalyzer} implementation depending on the mojo
60+
* The plexusContainer to look-up the right {@link ProjectDependencyAnalyzer} implementation depending on the mojo
6261
* configuration.
6362
*/
64-
private Context context;
63+
@Component
64+
private PlexusContainer plexusContainer;
6565

6666
/**
6767
* The Maven project to analyze.
@@ -300,20 +300,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
300300
* @throws MojoExecutionException in case of an error.
301301
*/
302302
protected ProjectDependencyAnalyzer createProjectDependencyAnalyzer() throws MojoExecutionException {
303+
303304
try {
304-
final PlexusContainer container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
305-
return container.lookup(ProjectDependencyAnalyzer.class, analyzer);
306-
} catch (Exception exception) {
305+
return plexusContainer.lookup(ProjectDependencyAnalyzer.class, analyzer);
306+
} catch (ComponentLookupException exception) {
307307
throw new MojoExecutionException(
308308
"Failed to instantiate ProjectDependencyAnalyser" + " / role-hint " + analyzer, exception);
309309
}
310310
}
311311

312-
@Override
313-
public void contextualize(Context theContext) {
314-
this.context = theContext;
315-
}
316-
317312
/**
318313
* @return {@link #skip}
319314
*/

0 commit comments

Comments
 (0)