Hello everyone,
I have following set up in my Jenkins instance (Version 2.240):
A Maven setting.xml is stored in Managed File -> Global Maven Settings.xml.
In Managed Jenkins -> Managed Tools, this settings.xml is set in Maven
configuration -> Default global settings provider -> Provided global
settings.xml.
Now I have following declarative pipeline script:
pipeline {
agent any
tools {
jdk "11.0.7.j9-adpt"
}
stages {
stage ('Maven Build') {
steps {
checkout scm
withMaven(maven: 'mvn-3.6.3') {
sh "mvn install"
}
}
}
stage ('Sonar analyse') {
steps {
withMaven(maven: 'mvn-3.6.3') {
sh "mvn sonar:sonar"
}
}
}
}
}
It works fine, but I like to reduce duplication like the withMaven
declarative. Therefore, I refactor the pipeline to the following one:
pipeline {
agent any
tools {
jdk "11.0.7.j9-adpt"
maven "mvn-3.6.3"
}
stages {
stage ('Maven Build') {
steps {
checkout scm
sh "mvn install"
}
}
stage ('Sonar analyse') {
steps {
sh "mvn sonar:sonar"
}
}
}
}
Unfortunately, with above pipeline script my global set Maven settings.xml
isn't used. So my question is, is there a trick that I can say global in my
pipeline script or in my Jenkins configuration that which settings.xml
should be used without using withMaven?
Thank you and best regards,
Sandra
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/847cb4af-4b00-4f8e-837a-accde87caff4o%40googlegroups.com.