1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Utils.evaluateFromMavenPom(): Handle errors (#1192)

Handle error to evaluate by throwing an exception
This commit is contained in:
Stephan Aßmus 2020-02-25 21:02:04 +01:00 committed by GitHub
parent 4835fbffab
commit 2014a8b4ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,5 +163,13 @@ static String evaluateFromMavenPom(Script script, String pomFileName, String pom
defines: "-Dexpression=$pomPathExpression -DforceStdout -q",
returnStdout: true
)
if (resolvedExpression.startsWith('null object or invalid expression')) {
// There is no error indication (exit code or otherwise) from the
// 'evaluate' Maven plugin, only this output to stdout. The calling
// code assumes an empty string is returned when the property could
// not be resolved.
throw new RuntimeException("Cannot evaluate property value from '${pomFileName}', " +
"missing property or invalid expression '${pomPathExpression}'.")
}
return resolvedExpression
}