This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 676456a Migrate from Plexus to Guice (#127) 676456a is described below commit 676456aba0f43280ed63ec3019bda8e385015924 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Tue Nov 19 02:05:58 2024 +0000 Migrate from Plexus to Guice (#127) * Migrate from Plexus to Guice --- pom.xml | 6 ++++ .../java/org/apache/maven/plugins/ear/EarMojo.java | 35 ++++++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index d8dbe66..08c460d 100644 --- a/pom.xml +++ b/pom.xml @@ -165,6 +165,12 @@ <artifactId>maven-shared-utils</artifactId> <version>3.4.2</version> </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java index cbf8b46..b9d4814 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.ear; +import javax.inject.Inject; + import java.io.BufferedWriter; import java.io.File; import java.io.IOException; @@ -49,7 +51,6 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.execution.MavenSession; 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.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -64,7 +65,6 @@ import org.apache.maven.shared.filtering.MavenResourcesExecution; import org.apache.maven.shared.filtering.MavenResourcesFiltering; import org.apache.maven.shared.mapping.MappingUtils; import org.apache.maven.shared.utils.io.FileUtils; -import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.ear.EarArchiver; @@ -238,13 +238,11 @@ public class EarMojo extends AbstractEarMojo { /** * The Plexus EAR archiver to create the output archive. */ - @Component(role = Archiver.class, hint = "ear") private EarArchiver earArchiver; /** - * The Plexus JAR archiver to create the output archive if not EAR application descriptor is provided (JavaEE 5+). + * The Plexus JAR archiver to create the output archive if no EAR application descriptor is provided (JavaEE 5+). */ - @Component(role = Archiver.class, hint = "jar") private JarArchiver jarArchiver; /** @@ -264,25 +262,15 @@ public class EarMojo extends AbstractEarMojo { @Parameter(defaultValue = "${project.build.outputTimestamp}") private String outputTimestamp; - /** - */ - @Component private MavenProjectHelper projectHelper; /** * The archive manager. */ - @Component private ArchiverManager archiverManager; - /** - */ - @Component(role = MavenFileFilter.class, hint = "default") private MavenFileFilter mavenFileFilter; - /** - */ - @Component(role = MavenResourcesFiltering.class, hint = "default") private MavenResourcesFiltering mavenResourcesFiltering; /** @@ -293,7 +281,24 @@ public class EarMojo extends AbstractEarMojo { private List<FilterWrapper> filterWrappers; + @Inject + public EarMojo( + EarArchiver earArchiver, + JarArchiver jarArchiver, + MavenProjectHelper projectHelper, + ArchiverManager archiverManager, + MavenFileFilter mavenFileFilter, + MavenResourcesFiltering mavenResourcesFiltering) { + this.earArchiver = earArchiver; + this.jarArchiver = jarArchiver; + this.projectHelper = projectHelper; + this.archiverManager = archiverManager; + this.mavenFileFilter = mavenFileFilter; + this.mavenResourcesFiltering = mavenResourcesFiltering; + } + /** {@inheritDoc} */ + @Override public void execute() throws MojoExecutionException, MojoFailureException { // Initializes ear modules super.execute();