This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch inject2 in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit e8598d242345cbbdfdb011bddde9f81521e31367 Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Sun Nov 17 09:37:03 2024 -0500 Migrate AnalyzeDepMgt to Sisu --- pom.xml | 19 +++++++++++++++++ .../plugins/dependency/analyze/AnalyzeDepMgt.java | 24 ++++++++++------------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 5cdf2565..eeda3ac7 100644 --- a/pom.xml +++ b/pom.xml @@ -146,6 +146,13 @@ 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> @@ -452,6 +459,18 @@ under the License. <groupId>org.eclipse.sisu</groupId> <artifactId>sisu-maven-plugin</artifactId> </plugin> + <plugin> + <groupId>org.eclipse.sisu</groupId> + <artifactId>sisu-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-index</id> + <goals> + <goal>main-index</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java index b118183e..5c8dbaa5 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.dependency.analyze; +import javax.inject.Named; + import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashSet; @@ -33,7 +35,6 @@ import org.apache.maven.model.Exclusion; 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; @@ -51,10 +52,7 @@ import org.apache.maven.project.MavenProject; public class AnalyzeDepMgt extends AbstractMojo { // fields ----------------------------------------------------------------- - /** - * - */ - @Component + @Named private MavenProject project; /** @@ -103,7 +101,7 @@ public class AnalyzeDepMgt extends AbstractMojo { /** * Does the work of checking the DependencyManagement Section. * - * @return true if errors are found. + * @return true if errors are found * @throws MojoExecutionException */ private boolean checkDependencyManagement() throws MojoExecutionException { @@ -169,8 +167,8 @@ public class AnalyzeDepMgt extends AbstractMojo { /** * Returns a map of the exclusions using the Dependency ManagementKey as the keyset. * - * @param exclusionList to be added to the map. - * @return a map of the exclusions using the Dependency ManagementKey as the keyset. + * @param exclusionList to be added to the map + * @return a map of the exclusions using the Dependency ManagementKey as the keyset */ public Map<String, Exclusion> addExclusions(List<Exclusion> exclusionList) { if (exclusionList != null) { @@ -183,9 +181,9 @@ public class AnalyzeDepMgt extends AbstractMojo { * Returns a List of the artifacts that should have been excluded, but were found in the dependency tree. * * @param exclusions a map of the DependencyManagement exclusions, with the ManagementKey as the key and Dependency - * as the value. - * @param allDependencyArtifacts resolved artifacts to be compared. - * @return list of artifacts that should have been excluded. + * as the value + * @param allDependencyArtifacts resolved artifacts to be compared + * @return list of artifacts that should have been excluded */ public List<Artifact> getExclusionErrors(Map<String, Exclusion> exclusions, Set<Artifact> allDependencyArtifacts) { return allDependencyArtifacts.stream() @@ -195,7 +193,7 @@ public class AnalyzeDepMgt extends AbstractMojo { /** * @param artifact {@link Artifact} - * @return The resulting GA. + * @return the resulting GA */ public String getExclusionKey(Artifact artifact) { return artifact.getGroupId() + ":" + artifact.getArtifactId(); @@ -203,7 +201,7 @@ public class AnalyzeDepMgt extends AbstractMojo { /** * @param ex The exclusion key. - * @return The resulting combination of groupId+artifactId. + * @return the resulting combination of groupId+artifactId */ public String getExclusionKey(Exclusion ex) { return ex.getGroupId() + ":" + ex.getArtifactId();