Package org.apache.maven.plugin.gpg
Class AbstractGpgMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.gpg.AbstractGpgMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
GpgSignAttachedMojo,SignAndDeployFileMojo
public abstract class AbstractGpgMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Field Summary
Fields Modifier and Type Field Description private booleandefaultKeyringWhether to add the default keyrings from gpg's home directory to the list of used keyrings.private java.lang.StringexecutableThe path to the GnuPG executable to use for artifact signing.private java.util.List<java.lang.String>gpgArgumentsSets the arguments to be passed to gpg.private java.io.FilehomedirThe directory from which gpg will load keyrings.private booleaninteractiveprivate java.lang.StringkeynameThe "name" of the key to sign with.private java.lang.StringlockModeThe lock mode to use when invoking gpg.private java.lang.StringpassphraseThe passphrase to use when signing.private java.lang.StringpassphraseServerIdServer id to lookup the passphrase under Maven settings.private java.lang.StringpublicKeyringThe path to a public keyring to add to the list of keyrings.private java.lang.StringsecretKeyringThe path to a secret keyring to add to the list of keyrings.private org.sonatype.plexus.components.sec.dispatcher.SecDispatchersecurityDispatcherMaven Security Dispatcherprivate org.apache.maven.settings.SettingssettingsCurrent user system settings for use in Maven.private booleanuseAgentPasses--use-agentor--no-use-agentto gpg.
-
Constructor Summary
Constructors Constructor Description AbstractGpgMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidloadGpgPassphrase()Load and decrypt gpg passphrase from Maven settings if not given from plugin configuration(package private) AbstractGpgSignernewSigner(org.apache.maven.project.MavenProject project)-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
homedir
@Parameter(property="gpg.homedir") private java.io.File homedir
The directory from which gpg will load keyrings. If not specified, gpg will use the value configured for its installation, e.g.~/.gnupgor%APPDATA%/gnupg.- Since:
- 1.0
-
passphrase
@Parameter(property="gpg.passphrase") private java.lang.String passphrase
The passphrase to use when signing. If not given, look up the value under Maven settings using server id at 'passphraseServerKey' configuration.
-
passphraseServerId
@Parameter(property="gpg.passphraseServerId", defaultValue="gpg.passphrase") private java.lang.String passphraseServerIdServer id to lookup the passphrase under Maven settings.- Since:
- 1.6
-
keyname
@Parameter(property="gpg.keyname") private java.lang.String keyname
The "name" of the key to sign with. Passed to gpg as--local-user.
-
useAgent
@Parameter(property="gpg.useagent", defaultValue="true") private boolean useAgentPasses--use-agentor--no-use-agentto gpg. If using an agent, the passphrase is optional as the agent will provide it. For gpg2, specify true as --no-use-agent was removed in gpg2 and doesn't ask for a passphrase anymore.
-
interactive
@Parameter(defaultValue="${settings.interactiveMode}", readonly=true) private boolean interactive
-
executable
@Parameter(property="gpg.executable") private java.lang.String executable
The path to the GnuPG executable to use for artifact signing. Defaults to either "gpg" or "gpg.exe" depending on the operating system.- Since:
- 1.1
-
defaultKeyring
@Parameter(property="gpg.defaultKeyring", defaultValue="true") private boolean defaultKeyringWhether to add the default keyrings from gpg's home directory to the list of used keyrings.- Since:
- 1.2
-
secretKeyring
@Parameter(property="gpg.secretKeyring") private java.lang.String secretKeyring
The path to a secret keyring to add to the list of keyrings. By default, only thesecring.gpgfrom gpg's home directory is considered. Use this option (in combination withpublicKeyringanddefaultKeyringif required) to use a different secret key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.- Since:
- 1.2
-
publicKeyring
@Parameter(property="gpg.publicKeyring") private java.lang.String publicKeyring
The path to a public keyring to add to the list of keyrings. By default, only thepubring.gpgfrom gpg's home directory is considered. Use this option (anddefaultKeyringif required) to use a different public key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.- Since:
- 1.2
-
lockMode
@Parameter(property="gpg.lockMode") private java.lang.String lockMode
The lock mode to use when invoking gpg. By default no lock mode will be specified. Valid values areonce,multipleandnever. The lock mode gets translated into the corresponding--lock-___command line argument. Improper usage of this option may lead to data and key corruption.- Since:
- 1.5
- See Also:
- the --lock-options
-
gpgArguments
@Parameter private java.util.List<java.lang.String> gpgArguments
Sets the arguments to be passed to gpg. Example:<gpgArguments> <arg>--no-random-seed-file</arg> <arg>--no-permission-warning</arg> </gpgArguments>
- Since:
- 1.5
-
settings
@Parameter(defaultValue="${settings}", readonly=true) private org.apache.maven.settings.Settings settingsCurrent user system settings for use in Maven.- Since:
- 1.6
-
securityDispatcher
@Component(hint="mng-4384") private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher securityDispatcher
Maven Security Dispatcher- Since:
- 1.6
-
-
Method Detail
-
newSigner
AbstractGpgSigner newSigner(org.apache.maven.project.MavenProject project) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
loadGpgPassphrase
private void loadGpgPassphrase() throws org.apache.maven.plugin.MojoFailureExceptionLoad and decrypt gpg passphrase from Maven settings if not given from plugin configuration- Throws:
org.apache.maven.plugin.MojoFailureException
-
-