Class AbstractJarsignerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
JarsignerSignMojo,JarsignerVerifyMojo
public abstract class AbstractJarsignerMojo extends org.apache.maven.plugin.AbstractMojoMaven Jarsigner Plugin base class.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringaliasSee options.private java.io.FilearchiveArchive to process.private java.io.FilearchiveDirectoryThe base directory to scan for JAR files using Ant-like inclusion/exclusion patterns.private java.lang.String[]argumentsList of additional arguments to append to the jarsigner command line.private java.lang.String[]excludeClassifiersA set of artifact classifiers describing the project attachments that should not be processed.private java.lang.String[]excludesThe Ant-like exclusion patterns used to exclude JAR files from processing.private java.lang.String[]includeClassifiersA set of artifact classifiers describing the project attachments that should be processed.private java.lang.String[]includesThe Ant-like inclusion patterns used to select JAR files to process.private org.apache.maven.shared.jarsigner.JarSignerjarSignerprivate java.lang.StringkeystoreSee options.private java.lang.StringmaxMemoryThe maximum memory available to the JAR signer, e.g.private booleanprocessAttachedArtifactsControls processing of project attachments.private booleanprocessMainArtifactControls processing of the main artifact produced by the project.private org.apache.maven.project.MavenProjectprojectThe Maven project.private booleanprotectedAuthenticationPathMust be set to true if the password must be given via a protected authentication path such as a dedicated PIN reader.private java.lang.StringproviderArgSee options.private java.lang.StringproviderClassSee options.private java.lang.StringproviderNameSee options.private org.sonatype.plexus.components.sec.dispatcher.SecDispatchersecurityDispatcherprivate org.apache.maven.execution.MavenSessionsessionThe current build session instance.private org.apache.maven.settings.SettingssettingsThe Maven settings.private booleanskipSet totrueto disable the plugin.private java.lang.StringstorepassSee options.private java.lang.StringstoretypeSee options.private org.apache.maven.toolchain.ToolchainManagertoolchainManagerTo obtain a toolchain if possible.private booleanverboseSee options.private java.io.FileworkingDirectoryLocation of the working directory.
-
Constructor Summary
Constructors Constructor Description AbstractJarsignerMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.apache.maven.shared.jarsigner.JarSignerRequestcreateRequest(java.io.File archive)Creates the jar signer request to be executed.protected java.lang.Stringdecrypt(java.lang.String encoded)voidexecute()protected java.lang.StringgetCommandlineInfo(org.apache.maven.shared.utils.cli.Commandline commandLine)Gets a string representation of aCommandline.private java.lang.StringgetMessage(java.lang.String key)(package private) java.lang.StringgetMessage(java.lang.String key, java.lang.Object arg)private java.lang.StringgetMessage(java.lang.String key, java.lang.Object[] args)Gets a message for a given key from the resource bundle backing the implementation.private java.lang.StringgetMessage(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)java.lang.StringgetStorepass()java.lang.StringgetStoretype()private org.apache.maven.toolchain.ToolchaingetToolchain()FIXME tchemit-20123-11-13, need to find out how to do this...private booleanisZipFile(org.apache.maven.artifact.Artifact artifact)Checks whether the specified artifact is a ZIP file.protected voidpreProcessArchive(java.io.File archive)Pre-processes a given archive.private voidprocessArchive(java.io.File archive)Processes a given archive.private booleanprocessArtifact(org.apache.maven.artifact.Artifact artifact)Processes a given artifact.
-
-
-
Field Detail
-
verbose
@Parameter(property="jarsigner.verbose", defaultValue="false") private boolean verboseSee options.
-
keystore
@Parameter(property="jarsigner.keystore") private java.lang.String keystore
See options.
-
storetype
@Parameter(property="jarsigner.storetype") private java.lang.String storetype
See options.
-
storepass
@Parameter(property="jarsigner.storepass") private java.lang.String storepass
See options.
-
providerName
@Parameter(property="jarsigner.providerName") private java.lang.String providerName
See options.
-
providerClass
@Parameter(property="jarsigner.providerClass") private java.lang.String providerClass
See options.
-
providerArg
@Parameter(property="jarsigner.providerArg") private java.lang.String providerArg
See options.
-
alias
@Parameter(property="jarsigner.alias") private java.lang.String alias
See options.
-
maxMemory
@Parameter(property="jarsigner.maxMemory") private java.lang.String maxMemory
The maximum memory available to the JAR signer, e.g.256M. See -Xmx for more details.
-
archive
@Parameter(property="jarsigner.archive") private java.io.File archive
Archive to process. If set, neither the project artifact nor any attachments or archive sets are processed.
-
archiveDirectory
@Parameter(property="jarsigner.archiveDirectory") private java.io.File archiveDirectory
The base directory to scan for JAR files using Ant-like inclusion/exclusion patterns.- Since:
- 1.1
-
includes
@Parameter private java.lang.String[] includes
The Ant-like inclusion patterns used to select JAR files to process. The patterns must be relative to the directory given by the parameterarchiveDirectory. By default, the pattern**/*.?aris used.- Since:
- 1.1
-
excludes
@Parameter private java.lang.String[] excludes
The Ant-like exclusion patterns used to exclude JAR files from processing. The patterns must be relative to the directory given by the parameterarchiveDirectory.- Since:
- 1.1
-
arguments
@Parameter(property="jarsigner.arguments") private java.lang.String[] arguments
List of additional arguments to append to the jarsigner command line.
-
skip
@Parameter(property="jarsigner.skip", defaultValue="false") private boolean skipSet totrueto disable the plugin.
-
processMainArtifact
@Parameter(property="jarsigner.processMainArtifact", defaultValue="true") private boolean processMainArtifactControls processing of the main artifact produced by the project.- Since:
- 1.1
-
processAttachedArtifacts
@Parameter(property="jarsigner.processAttachedArtifacts", defaultValue="true") private boolean processAttachedArtifactsControls processing of project attachments. If enabled, attached artifacts that are no JAR/ZIP files will be automatically excluded from processing.- Since:
- 1.1
-
protectedAuthenticationPath
@Parameter(property="jarsigner.protectedAuthenticationPath", defaultValue="false") private boolean protectedAuthenticationPathMust be set to true if the password must be given via a protected authentication path such as a dedicated PIN reader.- Since:
- 1.3
-
includeClassifiers
@Parameter private java.lang.String[] includeClassifiers
A set of artifact classifiers describing the project attachments that should be processed. This parameter is only relevant ifprocessAttachedArtifactsistrue. If empty, all attachments are included.- Since:
- 1.2
-
excludeClassifiers
@Parameter private java.lang.String[] excludeClassifiers
A set of artifact classifiers describing the project attachments that should not be processed. This parameter is only relevant ifprocessAttachedArtifactsistrue. If empty, no attachments are excluded.- Since:
- 1.2
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject projectThe Maven project.
-
settings
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settingsThe Maven settings.- Since:
- 1.5
-
workingDirectory
@Parameter(defaultValue="${project.basedir}") private java.io.File workingDirectoryLocation of the working directory.- Since:
- 1.3
-
jarSigner
@Component private org.apache.maven.shared.jarsigner.JarSigner jarSigner
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession sessionThe current build session instance. This is used for toolchain manager API calls.- Since:
- 1.3
-
toolchainManager
@Component private org.apache.maven.toolchain.ToolchainManager toolchainManager
To obtain a toolchain if possible.- Since:
- 1.3
-
securityDispatcher
@Component(hint="mng-4384") private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher securityDispatcher
- Since:
- 1.3.2
-
-
Method Detail
-
execute
public final void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createRequest
protected abstract org.apache.maven.shared.jarsigner.JarSignerRequest createRequest(java.io.File archive) throws org.apache.maven.plugin.MojoExecutionExceptionCreates the jar signer request to be executed.- Parameters:
archive- the archive file to treat by jarsigner- Returns:
- the request
- Throws:
org.apache.maven.plugin.MojoExecutionException- if an exception occurs- Since:
- 1.3
-
getCommandlineInfo
protected java.lang.String getCommandlineInfo(org.apache.maven.shared.utils.cli.Commandline commandLine)
Gets a string representation of aCommandline.This method creates the string representation by calling
commandLine.toString()by default.- Parameters:
commandLine- TheCommandlineto get a string representation of.- Returns:
- The string representation of
commandLine. - Throws:
java.lang.NullPointerException- ifcommandLineisnull.
-
getStoretype
public java.lang.String getStoretype()
-
getStorepass
public java.lang.String getStorepass()
-
isZipFile
private boolean isZipFile(org.apache.maven.artifact.Artifact artifact)
Checks whether the specified artifact is a ZIP file.- Parameters:
artifact- The artifact to check, may benull.- Returns:
trueif the artifact looks like a ZIP file,falseotherwise.
-
processArtifact
private boolean processArtifact(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionExceptionProcesses a given artifact.- Parameters:
artifact- The artifact to process.- Returns:
trueif the artifact is a JAR and was processed,falseotherwise.- Throws:
java.lang.NullPointerException- ifartifactisnull.org.apache.maven.plugin.MojoExecutionException- if processingartifactfails.
-
preProcessArchive
protected void preProcessArchive(java.io.File archive) throws org.apache.maven.plugin.MojoExecutionExceptionPre-processes a given archive.- Parameters:
archive- The archive to process, must not benull.- Throws:
org.apache.maven.plugin.MojoExecutionException- If pre-processing failed.
-
processArchive
private void processArchive(java.io.File archive) throws org.apache.maven.plugin.MojoExecutionExceptionProcesses a given archive.- Parameters:
archive- The archive to process.- Throws:
java.lang.NullPointerException- ifarchiveisnull.org.apache.maven.plugin.MojoExecutionException- if processingarchivefails.
-
decrypt
protected java.lang.String decrypt(java.lang.String encoded) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getMessage
private java.lang.String getMessage(java.lang.String key, java.lang.Object[] args)Gets a message for a given key from the resource bundle backing the implementation.- Parameters:
key- The key of the message to return.args- Arguments to format the message with ornull.- Returns:
- The message with key
keyfrom the resource bundle backing the implementation. - Throws:
java.lang.NullPointerException- ifkeyisnull.java.util.MissingResourceException- if there is no message available matchingkeyor accessing the resource bundle fails.
-
getMessage
private java.lang.String getMessage(java.lang.String key)
-
getMessage
java.lang.String getMessage(java.lang.String key, java.lang.Object arg)
-
getMessage
private java.lang.String getMessage(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
-
getToolchain
private org.apache.maven.toolchain.Toolchain getToolchain()
FIXME tchemit-20123-11-13, need to find out how to do this... TODO remove the part with ToolchainManager lookup once we depend on 2.0.9 (have it as prerequisite). Define as regular component field then.- Returns:
- Toolchain instance
-
-