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.AbstractMojo
Maven Jarsigner Plugin base class.
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
See options.private File
Archive to process.private File
The base directory to scan for JAR files using Ant-like inclusion/exclusion patterns.private String[]
List of additional arguments to append to the jarsigner command line.private String[]
A set of artifact classifiers describing the project attachments that should not be processed.private String[]
The Ant-like exclusion patterns used to exclude JAR files from processing.private String[]
A set of artifact classifiers describing the project attachments that should be processed.private String[]
The Ant-like inclusion patterns used to select JAR files to process.private org.apache.maven.shared.jarsigner.JarSigner
private String
See options.private String
The maximum memory available to the JAR signer, e.g.private boolean
Controls processing of project attachments.private boolean
Controls processing of the main artifact produced by the project.private org.apache.maven.project.MavenProject
The Maven project.private boolean
Must be set to true if the password must be given via a protected authentication path such as a dedicated PIN reader.private String
See options.private String
See options.private String
See options.private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher
private org.apache.maven.execution.MavenSession
The current build session instance.private org.apache.maven.settings.Settings
The Maven settings.private boolean
Set totrue
to disable the plugin.private String
See options.private String
See options.private org.apache.maven.toolchain.ToolchainManager
To obtain a toolchain if possible.private boolean
See options.private File
Location of the working directory.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.apache.maven.shared.jarsigner.JarSignerRequest
createRequest
(File archive) Creates the jar signer request to be executed.protected String
final void
execute()
protected String
getCommandlineInfo
(org.apache.maven.shared.utils.cli.Commandline commandLine) Gets a string representation of aCommandline
.private String
getMessage
(String key) (package private) String
getMessage
(String key, Object arg) private String
getMessage
(String key, Object[] args) Gets a message for a given key from the resource bundle backing the implementation.private String
getMessage
(String key, Object arg1, Object arg2) private org.apache.maven.toolchain.Toolchain
FIXME tchemit-20123-11-13, need to find out how to do this...private boolean
isZipFile
(org.apache.maven.artifact.Artifact artifact) Checks whether the specified artifact is a ZIP file.protected void
preProcessArchive
(File archive) Pre-processes a given archive.private void
processArchive
(File archive) Processes a given archive.private boolean
processArtifact
(org.apache.maven.artifact.Artifact artifact) Processes a given artifact.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
verbose
@Parameter(property="jarsigner.verbose", defaultValue="false") private boolean verboseSee options. -
keystore
See options. -
storetype
See options. -
storepass
See options. -
providerName
See options. -
providerClass
See options. -
providerArg
See options. -
alias
See options. -
maxMemory
The maximum memory available to the JAR signer, e.g.256M
. See -Xmx for more details. -
archive
Archive to process. If set, neither the project artifact nor any attachments or archive sets are processed. -
archiveDirectory
The base directory to scan for JAR files using Ant-like inclusion/exclusion patterns.- Since:
- 1.1
-
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**/*.?ar
is used.- Since:
- 1.1
-
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
List of additional arguments to append to the jarsigner command line. -
skip
@Parameter(property="jarsigner.skip", defaultValue="false") private boolean skipSet totrue
to 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
A set of artifact classifiers describing the project attachments that should be processed. This parameter is only relevant ifprocessAttachedArtifacts
istrue
. If empty, all attachments are included.- Since:
- 1.2
-
excludeClassifiers
A set of artifact classifiers describing the project attachments that should not be processed. This parameter is only relevant ifprocessAttachedArtifacts
istrue
. 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
Location 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 toolchainManagerTo 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
-
-
Constructor Details
-
AbstractJarsignerMojo
public AbstractJarsignerMojo()
-
-
Method Details
-
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(File archive) throws org.apache.maven.plugin.MojoExecutionException Creates 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
-
getStoretype
-
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:
true
if the artifact looks like a ZIP file,false
otherwise.
-
processArtifact
private boolean processArtifact(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException Processes a given artifact.- Parameters:
artifact
- The artifact to process.- Returns:
true
if the artifact is a JAR and was processed,false
otherwise.- Throws:
NullPointerException
- ifartifact
isnull
.org.apache.maven.plugin.MojoExecutionException
- if processingartifact
fails.
-
preProcessArchive
protected void preProcessArchive(File archive) throws org.apache.maven.plugin.MojoExecutionException Pre-processes a given archive.- Parameters:
archive
- The archive to process, must not benull
.- Throws:
org.apache.maven.plugin.MojoExecutionException
- If pre-processing failed.
-
processArchive
Processes a given archive.- Parameters:
archive
- The archive to process.- Throws:
NullPointerException
- ifarchive
isnull
.org.apache.maven.plugin.MojoExecutionException
- if processingarchive
fails.
-
decrypt
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getMessage
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
key
from the resource bundle backing the implementation. - Throws:
NullPointerException
- ifkey
isnull
.MissingResourceException
- if there is no message available matchingkey
or accessing the resource bundle fails.
-
getMessage
-
getMessage
-
getMessage
-
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
-