updateParent ERRORs when plugin is executed via Jenkins CI (mvn io.github.pmckeown...) #449
-
In my customer project we are using the dependency-track-maven-plugin via Jenkins pipeline library, as one of the Jenkins pipeline steps.
The idea behind is, to keep this whole activity outside all our Maven projects. And instead enforce it via Jenkins CI. Most of our Maven artifacts do have a parent - but some don't. In case we do have a parent, everything works fine: But if we don't have a parent, the plugin throws an error. Is there any way to solve this? And prevent the plugin from throwing an ERROR if there is no parent? Regards, Michael |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's because The updateParent setting requires a boolean value. In maven expressions are coerced to the specific type. For boolean values the string value must be You could make use of maven's help:evaluate and a sh step capturing the out in jenkins: [[ $(mvn help:evaluate -q -DforceStdout=true -Dexpression=project.parent/) == "null/" ]] && echo false || echo true That would print Note: |
Beta Was this translation helpful? Give feedback.
It's because
dependency-track.updateParent
is set totrue
, which instructs the plugin to update the parent. However, neither a parent name (as${project.parent.artifactId}
resolves to a blank value) or parent UUID is provided. So the plugin cannot update the parent (which it is instructed to do).The updateParent setting requires a boolean value. In maven expressions are coerced to the specific type. For boolean values the string value must be
true
(case insensitive). Sadly there is no expression which you could use which would returntrue
if the project has a parent.You could make use of maven's help:evaluate and a sh step capturing the out in jenkins:
[[ $(mvn help:evaluate -q -DforceS…