Affects Version/s: 2.16.2
Fix Version/s: None
Cloudbees Jenkins 18.104.22.168-rolling
Maven 3.5.3 running in Docker container,
Container OS: CentOS 7.5.1804,
JDK: Oracle JDK 1.8.0_191
When calling the Maven versions plugin via Artifactory, the plugin doesn't use the resolver configured in the mavenBuild object.
Steps to reproduce
You need to have configured a Artifactory server on Jenkins - we will label it "AF-SERVER" in the pseudo-pipeline code here.
Maven is declared in the Jenkins tools under label MAVEN-353
The result of the above script is that, during the Maven build, the dependencies and plugins are fetched from the Artifactory repo.
However, when it comes to checking the version of the parent, Maven will search for it on the Maven central repo, based on the local Maven "settings.xml" file.
One would expect that the "versions" plugin uses the repository defined as the "resolver".
If it is not possible to change the settings.xml defined on the build agent, a possible workaround is to define a "settings.xml" referencing the Artifactory server in the Jenkins configuration files, using the Config Files provider plugin, and use the configured Maven tool directly (i.e. not through a MavenBuild object), referencing this settings file.
The pseudo code would look like: