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/12/19 12:31:49 UTC

(maven-jlink-plugin) branch guice created (now db5b77a)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a change to branch guice
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git


      at db5b77a  Use Guice injection for ZipArchiver

This branch includes the following new commits:

     new db5b77a  Use Guice injection for ZipArchiver

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-jlink-plugin) 01/01: Use Guice injection for ZipArchiver

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch guice
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git

commit db5b77a3080e6c5bab6412292a86313df9ce255e
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Thu Dec 19 07:31:42 2024 -0500

    Use Guice injection for ZipArchiver
---
 .../java/org/apache/maven/plugins/jlink/JLinkMojo.java   | 16 ++++++++--------
 .../org/apache/maven/plugins/jlink/JLinkMojoTest.java    |  2 +-
 .../apache/maven/plugins/jlink/MultipleLauncherTest.java |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index 1bf5e2b..5525239 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -38,6 +38,7 @@ package org.apache.maven.plugins.jlink;
  */
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
 import java.io.File;
 import java.io.IOException;
@@ -59,7 +60,6 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Resource;
 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;
@@ -73,7 +73,6 @@ import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.ToolchainManager;
 import org.apache.maven.toolchain.ToolchainPrivate;
 import org.apache.maven.toolchain.java.DefaultJavaToolChain;
-import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.zip.ZipArchiver;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
@@ -330,12 +329,6 @@ public class JLinkMojo extends AbstractJLinkMojo {
     @Parameter(defaultValue = "false")
     private boolean verbose;
 
-    /**
-     * The JAR archiver needed for archiving the environments.
-     */
-    @Component(role = Archiver.class, hint = "zip")
-    private ZipArchiver zipArchiver;
-
     /**
      * Set the JDK location to create a Java custom runtime image.
      */
@@ -385,13 +378,20 @@ public class JLinkMojo extends AbstractJLinkMojo {
 
     private final LocationManager locationManager;
 
+    /**
+     * The JAR archiver needed for archiving the environments.
+     */
+    private final ZipArchiver zipArchiver;
+
     @Inject
     public JLinkMojo(
             MavenProjectHelper projectHelper,
             ToolchainManager toolchainManager,
+            @Named("zip") ZipArchiver zipArchiver,
             MavenResourcesFiltering mavenResourcesFiltering,
             LocationManager locationManager) {
         super(toolchainManager);
+        this.zipArchiver = zipArchiver;
         this.mavenResourcesFiltering = mavenResourcesFiltering;
         this.projectHelper = projectHelper;
         this.locationManager = locationManager;
diff --git a/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java b/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java
index b6cfc33..eed3ae6 100644
--- a/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/jlink/JLinkMojoTest.java
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 public class JLinkMojoTest {
 
-    private JLinkMojo mojo = new JLinkMojo(null, null, null, null);
+    private JLinkMojo mojo = new JLinkMojo(null, null, null, null, null);
 
     @BeforeEach
     public void setUp() throws NoSuchFieldException, IllegalAccessException {
diff --git a/src/test/java/org/apache/maven/plugins/jlink/MultipleLauncherTest.java b/src/test/java/org/apache/maven/plugins/jlink/MultipleLauncherTest.java
index 5a49cbf..c8530d7 100644
--- a/src/test/java/org/apache/maven/plugins/jlink/MultipleLauncherTest.java
+++ b/src/test/java/org/apache/maven/plugins/jlink/MultipleLauncherTest.java
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 public class MultipleLauncherTest {
 
-    private JLinkMojo mojo = new JLinkMojo(null, null, null, null);
+    private JLinkMojo mojo = new JLinkMojo(null, null, null, null, null);
 
     @Test
     void testSingleLauncher() throws Exception {