Skip to content

Commit

Permalink
guice
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 11, 2024
1 parent 472f2a6 commit 71977de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.jarsigner;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;
import java.time.Duration;
Expand All @@ -42,6 +44,8 @@
import org.apache.maven.shared.utils.cli.Commandline;
import org.apache.maven.shared.utils.cli.javatool.JavaToolException;
import org.apache.maven.shared.utils.cli.javatool.JavaToolResult;
import org.apache.maven.toolchain.ToolchainManager;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;

/**
* Signs a project artifact and attachments using jarsigner.
Expand Down Expand Up @@ -225,6 +229,11 @@ public class JarsignerSignMojo extends AbstractJarsignerMojo {
/** Exponent limit for exponential wait after failure function. 2^20 = 1048576 sec ~= 12 days. */
private static final int MAX_WAIT_EXPONENT_ATTEMPT = 20;

@Inject
public JarsignerSignMojo(JarSigner jarSigner, ToolchainManager toolchainManager, SecDispatcher securityDispatcher) {
super(jarSigner, toolchainManager, securityDispatcher);
}

@Override
protected String getCommandlineInfo(final Commandline commandLine) {
String commandLineInfo = commandLine != null ? commandLine.toString() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.jarsigner;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;

Expand All @@ -31,6 +33,8 @@
import org.apache.maven.shared.jarsigner.JarSignerVerifyRequest;
import org.apache.maven.shared.utils.cli.javatool.JavaToolException;
import org.apache.maven.shared.utils.cli.javatool.JavaToolResult;
import org.apache.maven.toolchain.ToolchainManager;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;

/**
* Checks the signatures of a project artifact and attachments using jarsigner.
Expand All @@ -49,15 +53,21 @@ public class JarsignerVerifyMojo extends AbstractJarsignerMojo {

/**
* When <code>true</code> this will make the execute() operation fail,
* throwing an exception, when verifying a non signed jar.
* throwing an exception, when verifying an unsigned jar.
* Primarily to keep backwards compatibility with existing code, and allow reusing the
* bean in unattended operations when set to <code>false</code>.
* mojo in unattended operations when set to <code>false</code>.
*
* @since 1.3
**/
@Parameter(property = "jarsigner.errorWhenNotSigned", defaultValue = "false")
private boolean errorWhenNotSigned;

@Inject
public JarsignerVerifyMojo(
JarSigner jarSigner, ToolchainManager toolchainManager, SecDispatcher securityDispatcher) {
super(jarSigner, toolchainManager, securityDispatcher);
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 71977de

Please sign in to comment.