This part of the pipeline library provides utility functions for maven.
purgeSnapshots(Map config)
purgeSnapshots(String repositoryPath = null, Boolean dryRun = false, LogLevel logLevel = null)
This function is a map based adapter function for purgeSnapshots
Complete list of all configuration options.
💡 In order to use node specific repository locations you can also specify the path to the repo in the environment variable M2_REPO
.
All configuration options must be inside the MAVEN_PURGE_SNAPSHOTS
(ConfigConstants.MAVEN_PURGE_SNAPSHOTS
)
map element to be evaluated and used by the function.
import io.wcm.devops.jenkins.pipeline.utils.logging.LogLevel
import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
maven.purgeSnapshots(
(MAVEN_PURGE_SNAPSHOTS): [
(MAVEN_PURGE_SNAPSHOTS_REPO_PATH) : null,
(MAVEN_PURGE_SNAPSHOTS_DRY_RUN) : false,
(MAVEN_PURGE_SNAPSHOTS_LOG_LEVEL) : LogLevel.INFO,
]
)
Constant | ConfigConstants.MAVEN_PURGE_SNAPSHOTS_REPO_PATH |
Type | String |
Default | null |
The path to the maven repository.
Constant | ConfigConstants.MAVEN_PURGE_SNAPSHOTS_DRY_RUN |
Type | Boolean |
Default | false |
Controls if the snapshot purging is executed in test mode.
Constant | ConfigConstants.MAVEN_PURGE_SNAPSHOTS_LOG_LEVEL |
Type | Boolean |
Default | null |
The log level of the managed shell script.
This function uses the managed pipeline shell script purge-snapshots.sh
This scrips searches for SNAPSHOT artifacts in the specified maven repository and deletes them.
Normally this script searches under $HOME/.m2/repository
but this can be adjusted by setting a repositoryPath
or using the environment variable M2_PATH
.
When dryRun
is set to true
the script will only simulate the purge.
With the parameter logLevel
the verbosity of the managed shell script can be adjusted.