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 @@ */ import javax.inject.Inject; +import javax.inject.Named; import java.io.File; import java.io.IOException; @@ -59,7 +60,6 @@ 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.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 @@ 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 @@ 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 {