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-jarsigner-plugin.git
commit 472f2a656564e817a5c89103708903ab3641f915 Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Wed Dec 11 06:50:56 2024 -0500 Convert to Guice @Inject --- .../plugins/jarsigner/AbstractJarsignerMojo.java | 19 +++++----- src/main/resources/META-INF/plexus/components.xml | 42 ---------------------- 2 files changed, 11 insertions(+), 50 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java b/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java index db583e9..5af55ce 100644 --- a/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java +++ b/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java @@ -237,11 +237,6 @@ public abstract class AbstractJarsignerMojo extends AbstractMojo { @Parameter(defaultValue = "${project.basedir}") private File workingDirectory; - /** - */ - @Component - private JarSigner jarSigner; - /** * The current build session instance. This is used for * toolchain manager API calls. @@ -251,19 +246,27 @@ public abstract class AbstractJarsignerMojo extends AbstractMojo { @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; + private final JarSigner jarSigner; + /** * To obtain a toolchain if possible. * * @since 1.3 */ - @Component - private ToolchainManager toolchainManager; + private final ToolchainManager toolchainManager; /** * @since 1.3.2 */ @Component(hint = "mng-4384") - private SecDispatcher securityDispatcher; + private final SecDispatcher securityDispatcher; + + protected AbstractJarsignerMojo( + JarSigner jarSigner, ToolchainManager toolchainManager, SecDispatcher securityDispatcher) { + this.jarSigner = jarSigner; + this.toolchainManager = toolchainManager; + this.securityDispatcher = securityDispatcher; + } @Override public final void execute() throws MojoExecutionException { diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index 388ccc8..0000000 --- a/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,42 +0,0 @@ -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<component-set> - <components> - <component> - <role>org.sonatype.plexus.components.sec.dispatcher.SecDispatcher</role> - <role-hint>mng-4384</role-hint> - <implementation>org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher</implementation> - <requirements> - <requirement> - <role>org.sonatype.plexus.components.cipher.PlexusCipher</role> - <role-hint>mng-4384</role-hint> - <field-name>_cipher</field-name> - </requirement> - </requirements> - <configuration> - <_configuration-file>~/.m2/settings-security.xml</_configuration-file> - </configuration> - </component> - <component> - <role>org.sonatype.plexus.components.cipher.PlexusCipher</role> - <role-hint>mng-4384</role-hint> - <implementation>org.sonatype.plexus.components.cipher.DefaultPlexusCipher</implementation> - </component> - </components> -</component-set> \ No newline at end of file