my workaround: in the pom.xml I save all patterns as properties:
<coverage-exclusion-01>*/com/company/product//config//.</coverage-exclusion-01><coverage-exclusion-02>/com/company/cfa//CallDTO.</coverage-exclusion-02><coverage-exclusion-03>*/com/company/cfa/*/DAO.</coverage-exclusion-03>
And I use them to configure the maven jacoco plugin
<configuration> <excludes> <exclude>${coverage-exclusion-01}</exclude> <exclude>${coverage-exclusion-02}</exclude>
etc...
And then, in the pipeline file y read again the properties
script{
props = readMavenPom().getProperties()
exclusionPattern = props.entrySet().findAll\{entry -> entry.key.startsWith('coverage-exclusion-')}.collect{it.value}.join(',')
echo "exclusionPattern = ${exclusionPattern}"
}
jacoco( execPattern: '**/target/jacoco.exec', exclusionPattern: exclusionPattern)
It works, but is ugly
A workaround is to configure the exclusions in the Jenkins Jacoco-Plugin too.