mavenBuild¶
This step will install the maven project into the local maven repository.
Description¶
This step will install the maven project into the local maven repository. It will also prepare jacoco to record the code coverage and supports ci friendly versioning by flattening the pom before installing.
build with depedencies from a private repository¶
if your build has dependencies from a private repository you can include a project settings xml into the source code repository as below (replace the <url>
tag with a valid private repo url).
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>private.repo.id</id>
<username>${env.PIPER_VAULTCREDENTIAL_USERNAME}</username>
<password>${env.PIPER_VAULTCREDENTIAL_PASSWORD}</password>
</server>
</servers>
</settings>
PIPER_VAULTCREDENTIAL_USERNAME
and PIPER_VAULTCREDENTIAL_PASSWORD
are the username and password for the private repository and are exposed as environment variables that must be present
in the environment where the Piper step runs or alternatively can be created using :
vault general purpose credentials
include the below <repositories>
tag in your pom.xml
to reference the <server>
and make sure the values in the <id>
tags match
<repositories>
<repository>
<id>private.repo.id</id>
<url>https://private.repo.com/</url>
</repository>
</repositories>
Ensure the following configuration in the Piper config.yaml
to ensure the above settings xml is included and all steps can consume this parameter:
general:
projectSettingsFile: <path to the above settings.xml>
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
mavenBuild script: this
piper mavenBuild
Outputs¶
Output type | Details |
---|---|
commonPipelineEnvironment |
|
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
script | (yes) | reference to Jenkins main pipeline script |
altDeploymentRepositoryID | no | |
altDeploymentRepositoryPassword | no | pass via ENV, Vault or Jenkins credentials (altDeploymentRepositoryPasswordId ) |
altDeploymentRepositoryUrl | no | |
altDeploymentRepositoryUser | no | |
buildSettingsInfo | no | |
createBOM | no | |
createBuildArtifactsMetadata | no | |
customTlsCertificateLinks | no | |
deployFlags | no | |
flatten | no | |
globalSettingsFile | no | |
javaCaCertFilePath | no | |
logSuccessfulMavenTransfers | no | |
m2Path | no | |
pomPath | no | |
profiles | no | |
projectSettingsFile | no | |
publish | no | |
verbose | no | activates debug output |
verify | no |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
containerCommand | no | |
containerShell | no | |
dockerEnvVars | no | |
dockerImage | no | |
dockerName | no | |
dockerOptions | no | |
dockerPullImage | no | |
dockerVolumeBind | no | |
dockerWorkspace | no | |
stashContent | no |
Details¶
altDeploymentRepositoryID¶
Id for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_altDeploymentRepositoryID (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/repositoryId |
altDeploymentRepositoryPassword¶
Password for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_altDeploymentRepositoryPassword (if set) |
Secret | yes |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryPassword commonPipelineEnvironment: reference to: custom/repositoryPassword Jenkins credential id: id: altDeploymentRepositoryPasswordId Vault resource: name: altDeploymentRepositoryPasswordFileVaultSecretName default value: alt-deployment-repository-passowrd Vault paths:
|
altDeploymentRepositoryUrl¶
Url for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_altDeploymentRepositoryUrl (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryURL commonPipelineEnvironment: reference to: custom/repositoryUrl |
altDeploymentRepositoryUser¶
User for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_altDeploymentRepositoryUser (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryUsername commonPipelineEnvironment: reference to: custom/repositoryUsername |
buildSettingsInfo¶
build settings info is typically filled by the step automatically to create information about the build settings that were used during the maven build . This information is typically used for compliance related processes.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_buildSettingsInfo (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/buildSettingsInfo |
containerCommand¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Allows to specify start command for container created with dockerImage parameter to overwrite Piper default (/usr/bin/tail -f /dev/null).
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
containerShell¶
Jenkins-specific: Used for proper environment setup.
Allows to specify the shell to be executed for container with containerName.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
createBOM¶
Creates the bill of materials (BOM) using CycloneDX Maven plugin.
Scope | Details |
---|---|
Aliases | maven/createBOM |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
createBuildArtifactsMetadata¶
metadata about the artifacts that are build and published , this metadata is generally used by steps downstream in the pipeline
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
customTlsCertificateLinks¶
List of download links to custom TLS certificates. This is required to ensure trusted connections to instances with repositories (like nexus) when publish flag is set to true.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_customTlsCertificateLinks (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
deployFlags¶
maven deploy flags that will be used when publish is detected.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | - -Dmaven.main.skip=true - -Dmaven.test.skip=true - -Dmaven.install.skip=true |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerEnvVars¶
Jenkins-specific: Used for proper environment setup.
Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerImage¶
Jenkins-specific: Used for proper environment setup.
Name of the docker image that should be used. If empty, Docker is not used and the command is executed directly on the Jenkins system.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | maven:3.6-jdk-8 |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerName¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | mvn |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerOptions¶
Jenkins-specific: Used for proper environment setup.
Docker options to be set when starting the container.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerPullImage¶
Jenkins-specific: Used for proper environment setup.
Set this to 'false' to bypass a docker image pull. Useful during development process. Allows testing of images which are available in the local registry only.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerVolumeBind¶
Jenkins-specific: Used for proper environment setup.
Volumes that should be mounted into the docker container.
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerWorkspace¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME
.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
flatten¶
Defines if the pom files should be flattened to support ci friendly maven versioning.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
globalSettingsFile¶
Path to the mvn settings file that should be used as global settings file.
Scope | Details |
---|---|
Aliases | maven/globalSettingsFile |
Type | string |
Mandatory | no |
Default | $PIPER_globalSettingsFile (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenGlobalSettingsFile |
javaCaCertFilePath¶
path to the cacerts file used by Java. When maven publish is set to True and customTlsCertificateLinks (to deploy the artifact to a repository with a self signed cert) are provided to trust the self signed certs, Piper will extend the existing Java cacerts to include the new self signed certs. if not provided Piper will search for the cacerts in $JAVA_HOME/jre/lib/security/cacerts
Scope | Details |
---|---|
Aliases | maven/javaCaCertFilePath |
Type | string |
Mandatory | no |
Default | $PIPER_javaCaCertFilePath (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
logSuccessfulMavenTransfers¶
Configures maven to log successful downloads. This is set to false
by default to reduce the noise in build logs.
Scope | Details |
---|---|
Aliases | maven/logSuccessfulMavenTransfers |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
m2Path¶
Path to the location of the local repository that should be used.
Scope | Details |
---|---|
Aliases | maven/m2Path |
Type | string |
Mandatory | no |
Default | $PIPER_m2Path (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
pomPath¶
Path to the pom file which should be installed including all children.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | pom.xml |
Secret | no |
Configuration scope |
|
Resource references | none |
profiles¶
Defines list of maven build profiles to be used.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_profiles (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
projectSettingsFile¶
Path to the mvn settings file that should be used as project settings file.
Scope | Details |
---|---|
Aliases | maven/projectSettingsFile |
Type | string |
Mandatory | no |
Default | $PIPER_projectSettingsFile (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
publish¶
Configures maven to run the deploy plugin to publish artifacts to a repository.
Scope | Details |
---|---|
Aliases | maven/publish |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
script¶
Jenkins-specific: Used for proper environment setup.
The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this
parameter, as in script: this
. This allows the function to access the commonPipelineEnvironment
for retrieving, e.g. configuration parameters.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
stashContent¶
Jenkins-specific: Used for proper environment setup.
Specific stashes that should be considered for the step execution.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | - `` |
Secret | no |
Configuration scope |
|
Resource references | none |
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
verify¶
Instead of installing the artifact only the verify lifecycle phase is executed.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
altDeploymentRepositoryPasswordId¶
Jenkins-specific: Used for proper environment setup. See using credentials for details.
Jenkins credentials ID containing the artifact deployment repository password.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Configuration scope |
|