Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Latest commit

 

History

History
78 lines (53 loc) · 2.81 KB

maven.md

File metadata and controls

78 lines (53 loc) · 2.81 KB

maven

This part of the pipeline library provides utility functions for maven.

Table of contents

purgeSnapshots(Map config)

This function is a map based adapter function for purgeSnapshots

Configuration options

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,
        ]
    )

repoPath (optional)

Constant ConfigConstants.MAVEN_PURGE_SNAPSHOTS_REPO_PATH
Type String
Default null

The path to the maven repository.

dryRun (optional)

Constant ConfigConstants.MAVEN_PURGE_SNAPSHOTS_DRY_RUN
Type Boolean
Default false

Controls if the snapshot purging is executed in test mode.

logLevel (optional)

Constant ConfigConstants.MAVEN_PURGE_SNAPSHOTS_LOG_LEVEL
Type Boolean
Default null

The log level of the managed shell script.

purgeSnapshots(String repositoryPath = null, Boolean dryRun = false, LogLevel logLevel = null)

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.

Related