You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2024/11/21 20:07:43 UTC
(maven-help-plugin) branch guice2 created (now 70e89d7)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch guice2
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git
at 70e89d7 Use Sisu Guice instead of Plexus
This branch includes the following new commits:
new 70e89d7 Use Sisu Guice instead of Plexus
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-help-plugin) 01/01: Use Sisu Guice instead of Plexus
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch guice2
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git
commit 70e89d7a2fbe93138812a201f4be272b382f0132
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Thu Nov 21 15:07:33 2024 -0500
Use Sisu Guice instead of Plexus
---
.../apache/maven/plugins/help/DescribeMojo.java | 16 +++++++++
.../apache/maven/plugins/help/EvaluateMojo.java | 39 +++++++++++++---------
2 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
index 19a8118..12f1439 100644
--- a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
@@ -32,6 +32,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import javax.inject.Inject;
+
import org.apache.maven.RepositoryUtils;
import org.apache.maven.lifecycle.DefaultLifecycles;
import org.apache.maven.lifecycle.Lifecycle;
@@ -126,6 +128,19 @@ public class DescribeMojo extends AbstractHelpMojo {
@Component
private Map<String, LifecycleMapping> lifecycleMappings;
+ @Inject
+ public DescribeMojo(MavenPluginManager pluginManager,
+ MojoDescriptorCreator mojoDescriptorCreator,
+ PluginVersionResolver pluginVersionResolver,
+ DefaultLifecycles defaultLifecycles,
+ Map<String, LifecycleMapping> lifecycleMappings) {
+ this.pluginManager = pluginManager;
+ this.mojoDescriptorCreator = mojoDescriptorCreator;
+ this.pluginVersionResolver = pluginVersionResolver;
+ this.defaultLifecycles = defaultLifecycles;
+ this.lifecycleMappings = lifecycleMappings;
+ }
+
// ----------------------------------------------------------------------
// Mojo parameters
// ----------------------------------------------------------------------
@@ -209,6 +224,7 @@ public class DescribeMojo extends AbstractHelpMojo {
/**
* {@inheritDoc}
*/
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
StringBuilder descriptionBuffer = new StringBuilder();
diff --git a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
index 975fd8a..3118f32 100644
--- a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
@@ -31,6 +31,8 @@ import java.util.TreeMap;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
+import javax.inject.Inject;
+
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.collections.PropertiesConverter;
@@ -44,7 +46,6 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
-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.project.MavenProject;
@@ -65,21 +66,6 @@ import org.eclipse.aether.artifact.DefaultArtifact;
*/
@Mojo(name = "evaluate", requiresProject = false)
public class EvaluateMojo extends AbstractHelpMojo {
- // ----------------------------------------------------------------------
- // Mojo components
- // ----------------------------------------------------------------------
-
- /**
- * Input handler, needed for command line handling.
- */
- @Component
- private InputHandler inputHandler;
-
- /**
- * Component used to get mojo descriptors.
- */
- @Component
- private MojoDescriptorCreator mojoDescriptorCreator;
// ----------------------------------------------------------------------
// Mojo parameters
@@ -145,11 +131,32 @@ public class EvaluateMojo extends AbstractHelpMojo {
/** lazy loading xstream variable */
private XStream xstream;
+ // ----------------------------------------------------------------------
+ // Mojo components
+ // ----------------------------------------------------------------------
+
+ /**
+ * Input handler, needed for command line handling.
+ */
+ private InputHandler inputHandler;
+
+ /**
+ * Component used to get mojo descriptors.
+ */
+ private MojoDescriptorCreator mojoDescriptorCreator;
+
+ @Inject
+ public EvaluateMojo(InputHandler inputHandler, MojoDescriptorCreator mojoDescriptorCreator) {
+ this.inputHandler = inputHandler;
+ this.mojoDescriptorCreator = mojoDescriptorCreator;
+ }
+
// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
/** {@inheritDoc} */
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (expression == null && !settings.isInteractiveMode()) {