Skip to content

Commit

Permalink
[MDEP-966] Migrate TreeMojo from Plexus to Sisu Guice
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 19, 2024
1 parent f14438f commit c5e9728
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ under the License.
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.9.0.M3</version>
<scope>provided</scope>
</dependency>

<!-- doxia -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.dependency.tree;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
Expand All @@ -32,7 +34,6 @@
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.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
Expand Down Expand Up @@ -75,27 +76,23 @@ public class TreeMojo extends AbstractMojo {
/**
* The Maven project.
*/
@Component
private MavenProject project;

@Component
private MavenSession session;

@Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}")
private String outputEncoding;

/**
* The dependency collector builder to use.
*/
@Component(hint = "default")
private DependencyCollectorBuilder dependencyCollectorBuilder;

/**
* The dependency graph builder to use.
*/
@Component(hint = "default")
private DependencyGraphBuilder dependencyGraphBuilder;

@Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}")
private String outputEncoding;

/**
* If specified, this parameter will cause the dependency tree to be written to the path specified, instead of
* writing to the console.
Expand Down Expand Up @@ -205,6 +202,19 @@ public class TreeMojo extends AbstractMojo {
*/
@Parameter(property = "skip", defaultValue = "false")
private boolean skip;

@Inject
public TreeMojo(
MavenProject project,
MavenSession session,
DependencyCollectorBuilder dependencyCollectorBuilder,
DependencyGraphBuilder dependencyGraphBuilder) {
this.project = project;
this.session = session;
this.dependencyCollectorBuilder = dependencyCollectorBuilder;
this.dependencyGraphBuilder = dependencyGraphBuilder;
}

// Mojo methods -----------------------------------------------------------

/*
Expand Down

0 comments on commit c5e9728

Please sign in to comment.