2020-04-24 10:41:49 +02:00
|
|
|
import com.sap.piper.DownloadCacheUtils
|
2018-08-15 11:53:28 +02:00
|
|
|
import groovy.transform.Field
|
|
|
|
|
2020-04-24 10:41:49 +02:00
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
2019-04-24 12:47:37 +02:00
|
|
|
|
2018-11-29 10:54:05 +02:00
|
|
|
@Field def STEP_NAME = getClass().getName()
|
2020-04-24 10:41:49 +02:00
|
|
|
@Field String METADATA_FILE = 'metadata/mavenExecute.yaml'
|
2018-08-15 11:53:28 +02:00
|
|
|
|
2020-01-23 10:31:01 +02:00
|
|
|
def call(Map parameters = [:]) {
|
|
|
|
final script = checkScript(this, parameters) ?: this
|
2020-04-24 10:41:49 +02:00
|
|
|
parameters = DownloadCacheUtils.injectDownloadCacheInMavenParameters(script, parameters)
|
2020-01-23 10:31:01 +02:00
|
|
|
|
2020-04-24 10:41:49 +02:00
|
|
|
List credentials = [ ]
|
|
|
|
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials)
|
2018-08-15 11:53:28 +02:00
|
|
|
|
2020-04-24 10:41:49 +02:00
|
|
|
String output = ''
|
|
|
|
if (parameters.returnStdout) {
|
|
|
|
String outputFile = '.pipeline/maven_output.txt'
|
|
|
|
if (!fileExists(outputFile)) {
|
|
|
|
error "[$STEP_NAME] Internal error. A text file with the contents of the maven output was expected " +
|
|
|
|
"but does not exist at '$outputFile'. " +
|
|
|
|
"Please file a ticket at https://github.com/SAP/jenkins-library/issues/new/choose"
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
2020-04-24 10:41:49 +02:00
|
|
|
output = readFile(outputFile)
|
2020-01-23 10:31:01 +02:00
|
|
|
}
|
2020-04-24 10:41:49 +02:00
|
|
|
return output
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|