gpg:sign-and-deploy-file

Full name:

org.apache.maven.plugins:maven-gpg-plugin:3.2.2:sign-and-deploy-file

Description:

Signs artifacts and installs the artifact in the remote repository.

Attributes:

  • The goal is thread-safe and supports parallel builds.
  • Since version: 1.0-beta-4.

Required Parameters

Name Type Since Description
<file> File - File to be deployed.
User Property: file
<repositoryId> String - Server Id to map on the <id> under <server> section of settings.xml. In most cases, this parameter will be required for authentication.
Default: remote-repository
User Property: repositoryId
<url> String - URL where the artifact will be deployed.
ie ( file:///C:/m2-repo or https://host.com/path/to/repo )
User Property: url

Optional Parameters

Name Type Since Description
<agentSocketLocations> String 3.2.0 BC Signer only: The comma separate list of Unix Domain Socket paths, to use to communicate with GnuPG agent. If relative, they are resolved against user home directory.
Default: .gnupg/S.gpg-agent
User Property: gpg.agentSocketLocations
<artifactId> String - ArtifactId of the artifact to be deployed. Retrieved from POM file if specified.
User Property: artifactId
<ascDirectory> File - The directory where to store signature files.
User Property: gpg.ascDirectory
<bestPractices> boolean 3.2.0 Switch to improve plugin enforcement of "best practices". If set to false, plugin retains all the backward compatibility regarding getting secrets (but will warn). If set to true, plugin will fail if any "bad practices" regarding sensitive data handling are detected. By default, plugin remains backward compatible (this flag is false). Somewhere in the future, when this parameter enabling transitioning from older plugin versions is removed, the logic using this flag will be modified like it is set to true. It is warmly advised to configure this parameter to true and migrate project and user environment regarding how sensitive information is stored.
Default: false
User Property: gpg.bestPractices
<classifier> String - Add classifier to the artifact
User Property: classifier
<classifiers> String - A comma separated list of classifiers for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in files or types, then an error will be raised.
User Property: classifiers
<defaultKeyring> boolean 1.2 GPG Signer only: Whether to add the default keyrings from gpg's home directory to the list of used keyrings.
Default: true
User Property: gpg.defaultKeyring
<description> String - Description passed to a generated POM file (in case of generatePom=true).
User Property: generatePom.description
<executable> String 1.1 GPG Signer only: The path to the GnuPG executable to use for artifact signing. Defaults to either "gpg" or "gpg.exe" depending on the operating system.
User Property: gpg.executable
<files> String - A comma separated list of files for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in types or classifiers, then an error will be raised.
User Property: files
<generatePom> boolean - Upload a POM for this artifact. Will generate a default POM if none is supplied with the pomFile argument.
Default: true
User Property: generatePom
<gpgArguments> List<String> 1.5 GPG Signer only: Sets the arguments to be passed to gpg. Example:
<gpgArguments>
  <arg>--no-random-seed-file</arg>
  <arg>--no-permission-warning</arg>
</gpgArguments>
<groupId> String - GroupId of the artifact to be deployed. Retrieved from POM file if specified.
User Property: groupId
<homedir> File 1.0 GPG Signer only: The directory from which gpg will load keyrings. If not specified, gpg will use the value configured for its installation, e.g. ~/.gnupg or %APPDATA%/gnupg.
User Property: gpg.homedir
<javadoc> File 1.3 The bundled API docs for the artifact.
User Property: javadoc
<keyEnvName> String 3.2.0 BC Signer only: The env variable name where the GnuPG key is set. To use BC Signer you must provide GnuPG key, as it does not use GnuPG home directory to extract/find the key (while it does use GnuPG Agent to ask for password in interactive mode). The key should be in TSK format and may be passphrase protected.
Default: MAVEN_GPG_KEY
User Property: gpg.keyEnvName
<keyFilePath> String 3.2.0 BC Signer only: The path of the exported key in TSK format, and may be passphrase protected. If relative, the file is resolved against user home directory.

Note: it is not recommended to have sensitive files checked into SCM repository. Key file should reside on developer workstation, outside of SCM tracked repository. For CI-like use cases you should set the key material as env variable instead.


Default: maven-signing-key.key
User Property: gpg.keyFilePath
<keyFingerprint> String 3.2.0 BC Signer only: The fingerprint of the key to use for signing. If not given, first key in keyring will be used.
User Property: gpg.keyFingerprint
<keyFingerprintEnvName> String 3.2.0 BC Signer only: The env variable name where the GnuPG key fingerprint is set, if the provided keyring contains multiple keys.
Default: MAVEN_GPG_KEY_FINGERPRINT
User Property: gpg.keyFingerprintEnvName
<keyname> String - GPG Signer only: The "name" of the key to sign with. Passed to gpg as --local-user.
User Property: gpg.keyname
<lockMode> String 1.5 GPG Signer only: The lock mode to use when invoking gpg. By default no lock mode will be specified. Valid values are once, multiple and never. The lock mode gets translated into the corresponding --lock-___ command line argument. Improper usage of this option may lead to data and key corruption.
See also: the --lock-options
User Property: gpg.lockMode
<packaging> String - Type of the artifact to be deployed. Retrieved from POM file if specified. Defaults to file extension if not specified via command line or POM.
User Property: packaging
<passphrase> String - Deprecated. The passphrase to use when signing. If not given, look up the value under Maven settings using server id at 'passphraseServerKey' configuration. Do not use this parameter, it leaks sensitive data. Passphrase should be provided only via gpg-agent or via env variable. If parameter bestPractices set to true, plugin fails when this parameter is configured.
User Property: gpg.passphrase
<passphraseEnvName> String 3.2.0 The env variable name where the GnuPG passphrase is set. This is the recommended way to pass passphrase for signing in batch mode execution of Maven.
Default: MAVEN_GPG_PASSPHRASE
User Property: gpg.passphraseEnvName
<passphraseServerId> String 1.6 Deprecated. Server id to lookup the passphrase under Maven settings. Do not use this parameter, it leaks sensitive data. Passphrase should be provided only via gpg-agent or via env variable. If parameter bestPractices set to true, plugin fails when this parameter is configured.
Default: gpg.passphrase
User Property: gpg.passphraseServerId
<pomFile> File - Location of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.
User Property: pomFile
<publicKeyring> String 1.2 Deprecated. GPG Signer only: The path to a public keyring to add to the list of keyrings. By default, only the pubring.gpg from gpg's home directory is considered. Use this option (and defaultKeyring if required) to use a different public key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.

NOTE: As of gpg 2.1 this is an obsolete option and ignored. All public keys are stored in the ‘pubring.kbx’ file below the GnuPG home directory.


User Property: gpg.publicKeyring
<retryFailedDeploymentCount> int 1.3 Parameter used to control how many times a failed deployment will be retried before giving up and failing. If a value outside the range 1-10 is specified it will be pulled to the nearest value within the range 1-10.
Default: 1
User Property: retryFailedDeploymentCount
<secretKeyring> String 1.2 Deprecated. GPG Signer only: The path to a secret keyring to add to the list of keyrings. By default, only the secring.gpg from gpg's home directory is considered. Use this option (in combination with publicKeyring and defaultKeyring if required) to use a different secret key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.

NOTE: As of gpg 2.1 this is an obsolete option and ignored. All secret keys are stored in the ‘private-keys-v1.d’ directory below the GnuPG home directory.


User Property: gpg.secretKeyring
<signer> String 3.2.0 The name of the Signer implementation to use. Accepted values are "gpg" (the default, uses GnuPG executable) and "bc" (uses Bouncy Castle pure Java signer).
Default: gpg
User Property: gpg.signer
<skip> boolean - Skip doing the gpg signing.
Default: false
User Property: gpg.skip
<sources> File 1.3 The bundled sources for the artifact.
User Property: sources
<types> String - A comma separated list of types for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in files or classifiers, then an error will be raised.
User Property: types
<useAgent> boolean - All signers: whether gpg-agent is allowed to be used or not. If enabled, passphrase is optional, as agent may provide it. Have to be noted, that in "batch" mode, gpg-agent will be prevented to pop up pinentry dialogue, hence best is to "prime" the agent caches beforehand.

GPG Signer: Passes --use-agent or --no-use-agent option to gpg if it is version 2.1 or older. Otherwise, will use an agent. In non-interactive mode gpg options are appended with --pinentry-mode error, preventing gpg agent to pop up pinentry dialogue. Agent will be able to hand over only cached passwords.

BC Signer: Allows signer to communicate with gpg agent. In non-interactive mode it uses --no-ask option with the GET_PASSPHRASE function. Agent will be able to hand over only cached passwords.


Default: true
User Property: gpg.useagent
<version> String - Version of the artifact to be deployed. Retrieved from POM file if specified.
User Property: version

Parameter Details

<agentSocketLocations>

BC Signer only: The comma separate list of Unix Domain Socket paths, to use to communicate with GnuPG agent. If relative, they are resolved against user home directory.
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.agentSocketLocations
  • Default: .gnupg/S.gpg-agent

<artifactId>

ArtifactId of the artifact to be deployed. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: artifactId

<ascDirectory>

The directory where to store signature files.
  • Type: java.io.File
  • Required: report.plugin.goal.no
  • User Property: gpg.ascDirectory

<bestPractices>

Switch to improve plugin enforcement of "best practices". If set to false, plugin retains all the backward compatibility regarding getting secrets (but will warn). If set to true, plugin will fail if any "bad practices" regarding sensitive data handling are detected. By default, plugin remains backward compatible (this flag is false). Somewhere in the future, when this parameter enabling transitioning from older plugin versions is removed, the logic using this flag will be modified like it is set to true. It is warmly advised to configure this parameter to true and migrate project and user environment regarding how sensitive information is stored.
  • Type: boolean
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.bestPractices
  • Default: false

<classifier>

Add classifier to the artifact
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: classifier

<classifiers>

A comma separated list of classifiers for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in files or types, then an error will be raised.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: classifiers

<defaultKeyring>

GPG Signer only: Whether to add the default keyrings from gpg's home directory to the list of used keyrings.
  • Type: boolean
  • Since: 1.2
  • Required: report.plugin.goal.no
  • User Property: gpg.defaultKeyring
  • Default: true

<description>

Description passed to a generated POM file (in case of generatePom=true).
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: generatePom.description

<executable>

GPG Signer only: The path to the GnuPG executable to use for artifact signing. Defaults to either "gpg" or "gpg.exe" depending on the operating system.
  • Type: java.lang.String
  • Since: 1.1
  • Required: report.plugin.goal.no
  • User Property: gpg.executable

<file>

File to be deployed.
  • Type: java.io.File
  • Required: report.plugin.goal.yes
  • User Property: file

<files>

A comma separated list of files for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in types or classifiers, then an error will be raised.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: files

<generatePom>

Upload a POM for this artifact. Will generate a default POM if none is supplied with the pomFile argument.
  • Type: boolean
  • Required: report.plugin.goal.no
  • User Property: generatePom
  • Default: true

<gpgArguments>

GPG Signer only: Sets the arguments to be passed to gpg. Example:
<gpgArguments>
  <arg>--no-random-seed-file</arg>
  <arg>--no-permission-warning</arg>
</gpgArguments>
  • Type: java.util.List<java.lang.String>
  • Since: 1.5
  • Required: report.plugin.goal.no

<groupId>

GroupId of the artifact to be deployed. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: groupId

<homedir>

GPG Signer only: The directory from which gpg will load keyrings. If not specified, gpg will use the value configured for its installation, e.g. ~/.gnupg or %APPDATA%/gnupg.
  • Type: java.io.File
  • Since: 1.0
  • Required: report.plugin.goal.no
  • User Property: gpg.homedir

<javadoc>

The bundled API docs for the artifact.
  • Type: java.io.File
  • Since: 1.3
  • Required: report.plugin.goal.no
  • User Property: javadoc

<keyEnvName>

BC Signer only: The env variable name where the GnuPG key is set. To use BC Signer you must provide GnuPG key, as it does not use GnuPG home directory to extract/find the key (while it does use GnuPG Agent to ask for password in interactive mode). The key should be in TSK format and may be passphrase protected.
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.keyEnvName
  • Default: MAVEN_GPG_KEY

<keyFilePath>

BC Signer only: The path of the exported key in TSK format, and may be passphrase protected. If relative, the file is resolved against user home directory.

Note: it is not recommended to have sensitive files checked into SCM repository. Key file should reside on developer workstation, outside of SCM tracked repository. For CI-like use cases you should set the key material as env variable instead.

  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.keyFilePath
  • Default: maven-signing-key.key

<keyFingerprint>

BC Signer only: The fingerprint of the key to use for signing. If not given, first key in keyring will be used.
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.keyFingerprint

<keyFingerprintEnvName>

BC Signer only: The env variable name where the GnuPG key fingerprint is set, if the provided keyring contains multiple keys.
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.keyFingerprintEnvName
  • Default: MAVEN_GPG_KEY_FINGERPRINT

<keyname>

GPG Signer only: The "name" of the key to sign with. Passed to gpg as --local-user.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: gpg.keyname

<lockMode>

GPG Signer only: The lock mode to use when invoking gpg. By default no lock mode will be specified. Valid values are once, multiple and never. The lock mode gets translated into the corresponding --lock-___ command line argument. Improper usage of this option may lead to data and key corruption.
See also: the --lock-options
  • Type: java.lang.String
  • Since: 1.5
  • Required: report.plugin.goal.no
  • User Property: gpg.lockMode

<packaging>

Type of the artifact to be deployed. Retrieved from POM file if specified. Defaults to file extension if not specified via command line or POM.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: packaging

<passphrase>

Deprecated. Do not use this configuration, it may leak sensitive information. Rely on gpg-agent or env variables instead.
The passphrase to use when signing. If not given, look up the value under Maven settings using server id at 'passphraseServerKey' configuration. Do not use this parameter, it leaks sensitive data. Passphrase should be provided only via gpg-agent or via env variable. If parameter bestPractices set to true, plugin fails when this parameter is configured.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: gpg.passphrase

<passphraseEnvName>

The env variable name where the GnuPG passphrase is set. This is the recommended way to pass passphrase for signing in batch mode execution of Maven.
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.passphraseEnvName
  • Default: MAVEN_GPG_PASSPHRASE

<passphraseServerId>

Deprecated. Do not use this configuration, it may leak sensitive information. Rely on gpg-agent or env variables instead.
Server id to lookup the passphrase under Maven settings. Do not use this parameter, it leaks sensitive data. Passphrase should be provided only via gpg-agent or via env variable. If parameter bestPractices set to true, plugin fails when this parameter is configured.
  • Type: java.lang.String
  • Since: 1.6
  • Required: report.plugin.goal.no
  • User Property: gpg.passphraseServerId
  • Default: gpg.passphrase

<pomFile>

Location of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.
  • Type: java.io.File
  • Required: report.plugin.goal.no
  • User Property: pomFile

<publicKeyring>

Deprecated. Obsolete option since GnuPG 2.1 version.
GPG Signer only: The path to a public keyring to add to the list of keyrings. By default, only the pubring.gpg from gpg's home directory is considered. Use this option (and defaultKeyring if required) to use a different public key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.

NOTE: As of gpg 2.1 this is an obsolete option and ignored. All public keys are stored in the ‘pubring.kbx’ file below the GnuPG home directory.

  • Type: java.lang.String
  • Since: 1.2
  • Required: report.plugin.goal.no
  • User Property: gpg.publicKeyring

<repositoryId>

Server Id to map on the <id> under <server> section of settings.xml. In most cases, this parameter will be required for authentication.
  • Type: java.lang.String
  • Required: report.plugin.goal.yes
  • User Property: repositoryId
  • Default: remote-repository

<retryFailedDeploymentCount>

Parameter used to control how many times a failed deployment will be retried before giving up and failing. If a value outside the range 1-10 is specified it will be pulled to the nearest value within the range 1-10.
  • Type: int
  • Since: 1.3
  • Required: report.plugin.goal.no
  • User Property: retryFailedDeploymentCount
  • Default: 1

<secretKeyring>

Deprecated. Obsolete option since GnuPG 2.1 version.
GPG Signer only: The path to a secret keyring to add to the list of keyrings. By default, only the secring.gpg from gpg's home directory is considered. Use this option (in combination with publicKeyring and defaultKeyring if required) to use a different secret key. Note: Relative paths are resolved against gpg's home directory, not the project base directory.

NOTE: As of gpg 2.1 this is an obsolete option and ignored. All secret keys are stored in the ‘private-keys-v1.d’ directory below the GnuPG home directory.

  • Type: java.lang.String
  • Since: 1.2
  • Required: report.plugin.goal.no
  • User Property: gpg.secretKeyring

<signer>

The name of the Signer implementation to use. Accepted values are "gpg" (the default, uses GnuPG executable) and "bc" (uses Bouncy Castle pure Java signer).
  • Type: java.lang.String
  • Since: 3.2.0
  • Required: report.plugin.goal.no
  • User Property: gpg.signer
  • Default: gpg

<skip>

Skip doing the gpg signing.
  • Type: boolean
  • Required: report.plugin.goal.no
  • User Property: gpg.skip
  • Default: false

<sources>

The bundled sources for the artifact.
  • Type: java.io.File
  • Since: 1.3
  • Required: report.plugin.goal.no
  • User Property: sources

<types>

A comma separated list of types for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries in files or classifiers, then an error will be raised.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: types

<url>

URL where the artifact will be deployed.
ie ( file:///C:/m2-repo or https://host.com/path/to/repo )
  • Type: java.lang.String
  • Required: report.plugin.goal.yes
  • User Property: url

<useAgent>

All signers: whether gpg-agent is allowed to be used or not. If enabled, passphrase is optional, as agent may provide it. Have to be noted, that in "batch" mode, gpg-agent will be prevented to pop up pinentry dialogue, hence best is to "prime" the agent caches beforehand.

GPG Signer: Passes --use-agent or --no-use-agent option to gpg if it is version 2.1 or older. Otherwise, will use an agent. In non-interactive mode gpg options are appended with --pinentry-mode error, preventing gpg agent to pop up pinentry dialogue. Agent will be able to hand over only cached passwords.

BC Signer: Allows signer to communicate with gpg agent. In non-interactive mode it uses --no-ask option with the GET_PASSPHRASE function. Agent will be able to hand over only cached passwords.

  • Type: boolean
  • Required: report.plugin.goal.no
  • User Property: gpg.useagent
  • Default: true

<version>

Version of the artifact to be deployed. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: report.plugin.goal.no
  • User Property: version