Class SignMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.cbi.maven.plugins.jarsigner.mojo.SignMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="sign", defaultPhase=PACKAGE) public class SignMojo extends org.apache.maven.plugin.AbstractMojoSigns project main and attached artifacts using the Eclipse jarsigner webservice. Only artifacts with.jarextension are signed, other artifacts are not signed but a warning message is logged.
-
-
Field Summary
Fields Modifier and Type Field Description private intconnectTimeoutMillisDeprecated.Use timeoutMillis instead.private booleancontinueOnFailWhether the build should be stopped if the signing process fails.private static intDEFAULT_RETRY_LIMITprivate static java.lang.StringDEFAULT_RETRY_LIMIT_STRINGprivate static intDEFAULT_RETRY_TIMERprivate static java.lang.StringDEFAULT_RETRY_TIMER_STRINGThe default number of seconds the process will wait ifprivate booleandeprecatedContinueOnFailDeprecated.The user propertycontinueOnFailis deprecated.private intdeprecatedRetryLimitDeprecated.The user propertyretryLimitis deprecated.private intdeprecatedRetryTimerDeprecated.The user propertyretryTimeris deprecated.private MessageDigestAlgorithmdigestAlgorithmThe digest algorithm to use for signing the jar file.private booleanexcludeInnerJarsWhether to excludes signing inner jars (not recursive, only apply to first level Jars inside the build Jar file; deeper jars are ignored in all cases).private org.apache.maven.project.MavenProjectprojectThe Maven project.private JarResigner.StrategyresigningStrategyThe strategy to be used if the artifacts of the current project are already signed (e.g., when replaced with a baseline version).private intretryLimitNumber of times to retry signing if the server fails to sign.private intretryTimerNumber of seconds to wait before retrying to sign.private java.lang.StringsigFileprivate SignatureAlgorithmsignatureAlgorithmThe signature algorithm to use for signing the jar file.private java.lang.StringsignerUrlThe signing service URL for signing Jar files.private booleanskipWhether the execution of this plugin should be skipped.private java.util.List<java.lang.String>supportedProjectTypesDeprecated.Not used anymore.private inttimeoutMillisDefines the wall timeout in milliseconds for performing the remote request.
-
Constructor Summary
Constructors Constructor Description SignMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleancontinueOnFail()private JarSignercreateJarSigner()Creates and returns theJarSigneraccording to the injected Mojo parameter.voidexecute()private intretryLimit()private intretryTimer()private voidsignArtifact(JarSigner jarSigner, org.apache.maven.artifact.Artifact artifact)
-
-
-
Field Detail
-
DEFAULT_RETRY_TIMER_STRING
private static final java.lang.String DEFAULT_RETRY_TIMER_STRING
The default number of seconds the process will wait if- See Also:
- Constant Field Values
-
DEFAULT_RETRY_TIMER
private static final int DEFAULT_RETRY_TIMER
-
DEFAULT_RETRY_LIMIT_STRING
private static final java.lang.String DEFAULT_RETRY_LIMIT_STRING
- See Also:
- Constant Field Values
-
DEFAULT_RETRY_LIMIT
private static final int DEFAULT_RETRY_LIMIT
-
project
@Parameter(defaultValue="${project}", readonly=true) private org.apache.maven.project.MavenProject projectThe Maven project.
-
signerUrl
@Parameter(required=true, property="cbi.jarsigner.signerUrl", defaultValue="http://build.eclipse.org:31338/sign") private java.lang.String signerUrlThe signing service URL for signing Jar files. This service should return a signed jar file.- Since:
- 1.0.4
-
skip
@Parameter(property="cbi.jarsigner.skip", defaultValue="false") private boolean skipWhether the execution of this plugin should be skipped.- Since:
- 1.0.4
-
deprecatedContinueOnFail
@Deprecated @Parameter(property="continueOnFail", defaultValue="false") private boolean deprecatedContinueOnFailDeprecated.The user propertycontinueOnFailis deprecated. You should use the qualified propertycbi.jarsigner.continueOnFailinstead. ThedeprecatedContinueOnFailparameter has been introduced to support this deprecated user property for backward compatibility only.Whether the build should be stopped if the signing process fails.- Since:
- 1.0.5 (for the user property, since 1.1.3 for the parameter).
-
continueOnFail
@Parameter(property="cbi.jarsigner.continueOnFail", defaultValue="false") private boolean continueOnFailWhether the build should be stopped if the signing process fails.- Since:
- 1.0.5 (for the parameter, since 1.1.3 for the qualified user property).
-
deprecatedRetryLimit
@Deprecated @Parameter(property="retryLimit", defaultValue="3") private int deprecatedRetryLimitDeprecated.The user propertyretryLimitis deprecated. You should use the qualified propertycbi.jarsigner.retryLimitinstead. ThedeprecatedRetryLimitparameter has been introduced to support this deprecated user property for backward compatibility only.Number of times to retry signing if the server fails to sign.- Since:
- 1.1.0 (for the property, since 1.1.3 for the parameter)
-
retryLimit
@Parameter(property="cbi.jarsigner.retryLimit", defaultValue="3") private int retryLimitNumber of times to retry signing if the server fails to sign.- Since:
- 1.1.0 (for the parameter, since 1.1.3 for the qualified user user property)
-
deprecatedRetryTimer
@Deprecated @Parameter(property="retryTimer", defaultValue="10") private int deprecatedRetryTimerDeprecated.The user propertyretryTimeris deprecated. You should use the qualified propertycbi.jarsigner.retryTimerinstead. ThedeprecatedRetryTimerparameter has been introduced to support this deprecated user property for backward compatibility only.Number of seconds to wait before retrying to sign.- Since:
- 1.1.0 (for the user property, since 1.1.3 for the parameter).
-
retryTimer
@Parameter(property="cbi.jarsigner.retryTimer", defaultValue="10") private int retryTimerNumber of seconds to wait before retrying to sign.- Since:
- 1.1.0 (for the parameter, since 1.1.3 for the qualified user user property)
-
excludeInnerJars
@Parameter(defaultValue="false") private boolean excludeInnerJars
Whether to excludes signing inner jars (not recursive, only apply to first level Jars inside the build Jar file; deeper jars are ignored in all cases).- Since:
- 1.0.5
-
supportedProjectTypes
@Deprecated @Parameter private java.util.List<java.lang.String> supportedProjectTypes
Deprecated.Not used anymore.Project types which this plugin supports.
-
resigningStrategy
@Parameter(property="cbi.jarsigner.resigningStrategy", defaultValue="RESIGN") private JarResigner.Strategy resigningStrategyThe strategy to be used if the artifacts of the current project are already signed (e.g., when replaced with a baseline version). Valid values are:- DO_NOT_RESIGN, do nothing with the jar file
- THROW_EXCEPTION, throws an exception and stop the
build if
continueOnFailproperty is not set - RESIGN, resigns the jar with the same parameter as
if it was not already signed (in particular the configured
digestAlgorithm) - RESIGN_WITH_SAME_DIGEST_ALGORITHM, resigns the jar
with the same digest algorithm as the one used when it has been
previously signed. Thus, the
digestAlgorithmis ignored for the already signed jars. - OVERWRITE, removes every signatures from the jar and
resigned it with the same parameter as if it was not already signed (in
particular the configured
digestAlgorithm) - OVERWRITE_WITH_SAME_DIGEST_ALGORITHM, removes every
signatures from the jar and resign it with the same digest algorithm as
the one used when it has been previously signed. Thus, the
digestAlgorithmis ignored for the already signed jars.
- Since:
- 1.1.3
-
digestAlgorithm
@Parameter(property="cbi.jarsigner.digestAlgorithm", defaultValue="DEFAULT") private MessageDigestAlgorithm digestAlgorithmThe digest algorithm to use for signing the jar file. Supported values depends on the remote signing web services. Values recognized by this plugin are:- DEFAULT, tells to the remote signing webservice to use its default digest algorithm to sign the jar
- MD2
- MD5
- SHA_1
- SHA1 Use this value if you need to be compatible with some old frameworks (e.g., Eclipse Equinox 3.7 / Indigo). Use SHA_1 otherwise.
- SHA_224
- SHA_256
- SHA_384
- SHA_512
- Since:
- 1.1.3
-
signatureAlgorithm
@Parameter(property="cbi.jarsigner.signatureAlgorithm", defaultValue="DEFAULT") private SignatureAlgorithm signatureAlgorithmThe signature algorithm to use for signing the jar file. Supported values depends on the remote signing web services. Values recognized by this plugin are:- DEFAULT, tells to the remote signing webservice to use its default digest algorithm to sign the jar
- NONEwithRSA
- MD2withRSA
- MD5withRSA
- SHA1withRSA
- SHA224withRSA
- SHA256withRSA
- SHA384withRSA
- SHA512withRSA
- SHA1withDSA
- SHA224withDSA
- SHA256withDSA
- NONEwithECDSA
- SHA1withECDSA
- SHA224withECDSA
- SHA256withECDSA
- SHA384withECDSA
- SHA512withECDSA
- Since:
- 1.1.3
-
connectTimeoutMillis
@Deprecated @Parameter(property="cbi.jarsigner.connectTimeoutMillis", defaultValue="5000") private int connectTimeoutMillisDeprecated.Use timeoutMillis instead. This one is for establishing the TCP connection only, you may be looking for a wall timeout instead.Defines the timeout in milliseconds for establishing a TCP connection with the signing server. A timeout value of zero is interpreted as an infinite timeout.- Since:
- 1.1.4
-
timeoutMillis
@Parameter(property="cbi.jarsigner.timeoutMillis", defaultValue="0") private int timeoutMillisDefines the wall timeout in milliseconds for performing the remote request. A timeout value of zero is interpreted as an infinite timeout.- Since:
- 1.1.5
-
sigFile
@Parameter(property="cbi.jarsigner.sigFile", defaultValue="") private java.lang.String sigFile- Since:
- 1.1.5
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
signArtifact
private void signArtifact(JarSigner jarSigner, org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
continueOnFail
private boolean continueOnFail()
-
retryLimit
private int retryLimit()
-
retryTimer
private int retryTimer()
-
-