Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59567

Server Credentials created from Jenkins credentials don't show up in maven settings.xml

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Also on SO: https://stackoverflow.com/questions/58139761/pipeline-maven-plugin-not-replacing-servers-in-global-settings-xml-from-jenkin

      hard coding "<servers></servers>" in the config file works but configuring "Server Credentials" from jenkins credentials is not working. I tried with and without "Replace all"

        Attachments

          Activity

          red888 red der created issue -
          Hide
          red888 red der added a comment -

          I linked the wrong ticket to this. This is a different issue than the one described in the ticket I linked initially

          Show
          red888 red der added a comment - I linked the wrong ticket to this. This is a different issue than the one described in the ticket I linked initially
          red888 red der made changes -
          Field Original Value New Value
          Description Looks like pretty much this same issue: https://issues.jenkins-ci.org/browse/JENKINS-29805

          Also on SO: [https://stackoverflow.com/questions/58139761/pipeline-maven-plugin-not-replacing-servers-in-global-settings-xml-from-jenkin]

          hard coding "<servers></servers>" in the config file works but configuring "Server Credentials" from jenkins credentials is not working. I tried with and without "Replace all"
          Also on SO: [https://stackoverflow.com/questions/58139761/pipeline-maven-plugin-not-replacing-servers-in-global-settings-xml-from-jenkin]

          hard coding "<servers></servers>" in the config file works but configuring "Server Credentials" from jenkins credentials is not working. I tried with and without "Replace all"
          Summary Credentials don't show up in maven settings.xml (regression) Server Credentials created from Jenkins credentials don't show up in maven settings.xml
          Hide
          cleclerc Cyrille Le Clerc added a comment - - edited

          Cross posting answer already made on https://groups.google.com/forum/#!topic/jenkinsci-users/7P1Wd2W-OcA

           Hello,

          This is one of the most broadly used feature of the pipeline-maven-plugin, I think it works for most user, there is probably a glitch somewhere.

          Can you please share your testing Jenkinsfile and the details reported by withMaven in the build logs?

          The troubleshooting pipeline script should look like

          withMaven(...) {
             sh "mvn help:effective-settings"
          }
          

          The build logs line that reports the credentials injected in the settings looks like

          [withMaven] using Maven global settings.xml 'global-settings-for-pipeline-maven-plugin' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'github', jenkinsCredentials: 'github-credentials', username: 'cyrille-leclerc', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'nexus3.example.com', jenkinsCredentials: 'api-team-nexus-deployment-credentials', username: 'api-team', type: 'UsernamePasswordCredentialsImpl']
          

           

          Show
          cleclerc Cyrille Le Clerc added a comment - - edited Cross posting answer already made on  https://groups.google.com/forum/#!topic/jenkinsci-users/7P1Wd2W-OcA  Hello, This is one of the most broadly used feature of the pipeline-maven-plugin, I think it works for most user, there is probably a glitch somewhere. Can you please share your testing Jenkinsfile and the details reported by withMaven in the build logs? The troubleshooting pipeline script should look like withMaven(...) { sh "mvn help:effective-settings" } The build logs line that reports the credentials injected in the settings looks like [withMaven] using Maven global settings.xml 'global-settings- for -pipeline-maven-plugin' with Maven servers credentials provided by Jenkins (replaceAll: false ): [mavenServerId: 'github' , jenkinsCredentials: 'github-credentials' , username: 'cyrille-leclerc' , type: 'UsernamePasswordCredentialsImpl' ], [mavenServerId: 'nexus3.example.com' , jenkinsCredentials: 'api-team-nexus-deployment-credentials' , username: 'api-team' , type: 'UsernamePasswordCredentialsImpl' ]  
          cleclerc Cyrille Le Clerc made changes -
          Assignee Dominik Bartholdi [ domi ] Cyrille Le Clerc [ cleclerc ]
          Hide
          red888 red der added a comment -

          this can be closed. I gave up and just used a secret file to store my entire config instead. I realized I dont really need this plugin

          Show
          red888 red der added a comment - this can be closed. I gave up and just used a secret file to store my entire config instead. I realized I dont really need this plugin
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Ack, i'm closing this ticket with "Can't reproduce" as several users have reported that this feature work for them. There me be an edge case or a glitch in the setup.

          Show
          cleclerc Cyrille Le Clerc added a comment - Ack, i'm closing this ticket with "Can't reproduce" as several users have reported that this feature work for them. There me be an edge case or a glitch in the setup.
          cleclerc Cyrille Le Clerc made changes -
          Resolution Cannot Reproduce [ 5 ]
          Status Open [ 1 ] Closed [ 6 ]
          Hide
          robross0606 Robert added a comment - - edited

          Whelp, I think I'm hitting this same exact "edge case".  I have tried both Global and user settings files, configured under Managed Files.  I've tried setting them as the default under tools configuration, as well as explicitly calling them by id on `withMaven`.  Nothing seems to work at all.  Using the steps to reproduce documented in this ticket, I crafted this stage:

            agent any
          
            tools {
              maven 'Maven_3.6.0'
              jdk 'jdk11'
            }
          
            stages {
              stage('Setup') {
                steps {
                  withMaven {
                    sh 'mvn help:effective-settings'
                  }
                }
              }
            }

          Running gets this in the pipeline log:

          [Pipeline] // stage
          [Pipeline] stage
          [Pipeline] { (Debug)
          [Pipeline] tool
          [Pipeline] envVarsForTool
          [Pipeline] tool
          [Pipeline] envVarsForTool
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] withMaven
          [2021-12-16T14:41:48.646Z] [withMaven] Options: []
          [2021-12-16T14:41:48.646Z] [withMaven] Available options: 
          [2021-12-16T14:41:48.646Z] [withMaven] using JDK installation provided by the build agent
          [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.myinternal.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.myinternal.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']
          [2021-12-16T14:41:48.653Z] $ /bin/sh -c "which mvn"
          [2021-12-16T14:41:48.660Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace.
          [Pipeline] {
          [Pipeline] sh
          [2021-12-16T14:41:48.954Z] + mvn help:effective-settings
          [2021-12-16T14:41:48.954Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f" 
          [2021-12-16T14:41:51.452Z] [INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f/maven-spy-20211216-144151-18111412161578554802831.log.tmp ...
          [2021-12-16T14:41:51.706Z] [INFO] Scanning for projects...
          [2021-12-16T14:41:52.257Z] [INFO] 
          [2021-12-16T14:41:52.257Z] [INFO] ------------------< com.myinternal.ncp:log-client-java >-------------------
          [2021-12-16T14:41:52.257Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT
          [2021-12-16T14:41:52.257Z] [INFO] --------------------------------[ jar ]---------------------------------
          [2021-12-16T14:41:52.508Z] [INFO] 
          [2021-12-16T14:41:52.508Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings (default-cli) @ log-client-java ---
          [2021-12-16T14:41:53.419Z] [INFO] 
          [2021-12-16T14:41:53.419Z] Effective user-specific configuration settings:
          [2021-12-16T14:41:53.419Z] 
          [2021-12-16T14:41:53.419Z] <?xml version="1.0" encoding="UTF-8"?>
          [2021-12-16T14:41:53.419Z] <!-- ====================================================================== -->
          [2021-12-16T14:41:53.419Z] <!--                                                                        -->
          [2021-12-16T14:41:53.419Z] <!-- Generated by Maven Help Plugin on 2021-12-16T14:41:53Z                 -->
          [2021-12-16T14:41:53.419Z] <!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
          [2021-12-16T14:41:53.419Z] <!--                                                                        -->
          [2021-12-16T14:41:53.419Z] <!-- ====================================================================== -->
          [2021-12-16T14:41:53.420Z] <!-- ====================================================================== -->
          [2021-12-16T14:41:53.420Z] <!--                                                                        -->
          [2021-12-16T14:41:53.420Z] <!-- Effective Settings for 'jenkins' on 'ip-***-***-***-***'               -->
          [2021-12-16T14:41:53.420Z] <!--                                                                        -->
          [2021-12-16T14:41:53.420Z] <!-- ====================================================================== -->
          [2021-12-16T14:41:53.420Z] <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
          [2021-12-16T14:41:53.420Z]   <localRepository>/var/lib/jenkins/.m2/repository</localRepository>
          [2021-12-16T14:41:53.420Z]   <pluginGroups>
          [2021-12-16T14:41:53.420Z]     <pluginGroup>org.apache.maven.plugins</pluginGroup>
          [2021-12-16T14:41:53.420Z]     <pluginGroup>org.codehaus.mojo</pluginGroup>
          [2021-12-16T14:41:53.420Z]   </pluginGroups>
          [2021-12-16T14:41:53.420Z] </settings>
          

          Absolutely nothing from the referenced "global-maven-settings" is actually in the effective settings when running mvn.  Not a servers section containing the auth data referenced just above in the pipeline logs, and not a single part of my actual settings.xml content which is stored on the managed file:

          <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
          	<activeProfiles>
          		<activeProfile>default</activeProfile>
          	</activeProfiles>
          	<profiles>
          		<profile>
          			<id>default</id>
          			<repositories>
          				<repository>
          					<releases>
          						<enabled>false</enabled>
          					</releases>
          					<snapshots>
          						<enabled>true</enabled>
          					</snapshots>
          					<id>com.myinternal.repo.snapshots</id>
          					<name>Internal Snapshots</name>
          					<url>https://artifact.myinternal.com/repository/maven-snapshots</url>
          				</repository>
          				<repository>
          					<releases>
          						<enabled>true</enabled>
          					</releases>
          					<snapshots>
          						<enabled>false</enabled>
          					</snapshots>
          					<id>com.myinternal.repo.releases</id>
          					<name>Internal Releases</name>
          					<url>https://artifact.myinternal.com/repository/maven-releases</url>
          				</repository>
          			</repositories>
          		</profile>
          	</profiles>
          </settings>
          
          Show
          robross0606 Robert added a comment - - edited Whelp, I think I'm hitting this same exact "edge case".  I have tried both Global and user settings files, configured under Managed Files.  I've tried setting them as the default under tools configuration, as well as explicitly calling them by id on `withMaven`.  Nothing seems to work at all.  Using the steps to reproduce documented in this ticket, I crafted this stage: agent any tools { maven 'Maven_3.6.0' jdk 'jdk11' }   stages { stage('Setup') { steps { withMaven { sh 'mvn help:effective-settings' } } } } Running gets this in the pipeline log: [Pipeline] // stage [Pipeline] stage [Pipeline] { (Debug) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] withEnv [Pipeline] { [Pipeline] withMaven [2021-12-16T14:41:48.646Z] [withMaven] Options: [] [2021-12-16T14:41:48.646Z] [withMaven] Available options: [2021-12-16T14:41:48.646Z] [withMaven] using JDK installation provided by the build agent [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.myinternal.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.myinternal.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'] [2021-12-16T14:41:48.653Z] $ /bin/sh -c "which mvn" [2021-12-16T14:41:48.660Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace. [Pipeline] { [Pipeline] sh [2021-12-16T14:41:48.954Z] + mvn help:effective-settings [2021-12-16T14:41:48.954Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f" [2021-12-16T14:41:51.452Z] [INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven1b728b0f/maven-spy-20211216-144151-18111412161578554802831.log.tmp ... [2021-12-16T14:41:51.706Z] [INFO] Scanning for projects... [2021-12-16T14:41:52.257Z] [INFO] [2021-12-16T14:41:52.257Z] [INFO] ------------------< com.myinternal.ncp:log-client-java >------------------- [2021-12-16T14:41:52.257Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT [2021-12-16T14:41:52.257Z] [INFO] --------------------------------[ jar ]--------------------------------- [2021-12-16T14:41:52.508Z] [INFO] [2021-12-16T14:41:52.508Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings (default-cli) @ log-client-java --- [2021-12-16T14:41:53.419Z] [INFO] [2021-12-16T14:41:53.419Z] Effective user-specific configuration settings: [2021-12-16T14:41:53.419Z] [2021-12-16T14:41:53.419Z] <?xml version="1.0" encoding="UTF-8"?> [2021-12-16T14:41:53.419Z] <!-- ====================================================================== --> [2021-12-16T14:41:53.419Z] <!-- --> [2021-12-16T14:41:53.419Z] <!-- Generated by Maven Help Plugin on 2021-12-16T14:41:53Z --> [2021-12-16T14:41:53.419Z] <!-- See: http://maven.apache.org/plugins/maven-help-plugin/ --> [2021-12-16T14:41:53.419Z] <!-- --> [2021-12-16T14:41:53.419Z] <!-- ====================================================================== --> [2021-12-16T14:41:53.420Z] <!-- ====================================================================== --> [2021-12-16T14:41:53.420Z] <!-- --> [2021-12-16T14:41:53.420Z] <!-- Effective Settings for 'jenkins' on 'ip-***-***-***-***' --> [2021-12-16T14:41:53.420Z] <!-- --> [2021-12-16T14:41:53.420Z] <!-- ====================================================================== --> [2021-12-16T14:41:53.420Z] <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> [2021-12-16T14:41:53.420Z] <localRepository>/var/lib/jenkins/.m2/repository</localRepository> [2021-12-16T14:41:53.420Z] <pluginGroups> [2021-12-16T14:41:53.420Z] <pluginGroup>org.apache.maven.plugins</pluginGroup> [2021-12-16T14:41:53.420Z] <pluginGroup>org.codehaus.mojo</pluginGroup> [2021-12-16T14:41:53.420Z] </pluginGroups> [2021-12-16T14:41:53.420Z] </settings> Absolutely nothing from the referenced "global-maven-settings" is actually in the effective settings when running mvn .  Not a servers section containing the auth data referenced just above in the pipeline logs, and not a single part of my actual settings.xml content which is stored on the managed file: <settings xmlns= "http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd" > <activeProfiles> <activeProfile> default </activeProfile> </activeProfiles> <profiles> <profile> <id> default </id> <repositories> <repository> <releases> <enabled> false </enabled> </releases> <snapshots> <enabled> true </enabled> </snapshots> <id> com.myinternal.repo.snapshots </id> <name> Internal Snapshots </name> <url> https://artifact.myinternal.com/repository/maven-snapshots </url> </repository> <repository> <releases> <enabled> true </enabled> </releases> <snapshots> <enabled> false </enabled> </snapshots> <id> com.myinternal.repo.releases </id> <name> Internal Releases </name> <url> https://artifact.myinternal.com/repository/maven-releases </url> </repository> </repositories> </profile> </profiles> </settings>
          robross0606 Robert made changes -
          Resolution Cannot Reproduce [ 5 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          aheritier Arnaud Héritier added a comment -

          Hi Robert

          Which version are you using for the pipeline-maven-plugin and config-file-provider ?

          In the sample you shared you configured the settings as Default global settings provider in the tools configuration ? No as Default settings provider ?

          [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.nurocor.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.nurocor.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']
          
          Show
          aheritier Arnaud Héritier added a comment - Hi Robert Which version are you using for the pipeline-maven-plugin and config-file-provider ? In the sample you shared you configured the settings as Default global settings provider in the tools configuration ? No as Default settings provider ? [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.nurocor.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.nurocor.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']
          Hide
          robross0606 Robert added a comment - - edited

          Which version are you using for the pipeline-maven-plugin and config-file-provider?

          • pipeline-maven-plugin: 3.10.0
          • config-file-provider: 3.8.2

          In the sample you shared you configured the settings as Default global settings provider in the tools configuration ? No as Default settings provider?

          According to how I interpreted this plugin's documentation, the only "default" thing the plugin will fall back on when calling withMaven() without specifying additional (optional) parameters is the "global" one.  But that could just be missing documentation. In any case, I've tried it with global only, user only and both.  I get the same results all three ways.  In the example output above, I had both specified with the same information in both managed files as a desperate attempt to debug this issue by trial and error. 

          The plugin output in the logs didn't even mention the user config.

          [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.myinternal.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.myinternal.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']

          Note that the "global" settings are mentioned (with credentials even being correctly called out) but the "user" settings are entirely ignored even though (by Maven design) the "user" settings should override the "global" settings.  Nevertheless, I assumed this was by plugin design since the documentation more or less says as much.

          In any case, even though that log line clearly states that it found the settings and parsed them (including credentials), nothing actually shows up in the effective settings inside withMaven() execution scope.

          Show
          robross0606 Robert added a comment - - edited Which version are you using for the pipeline-maven-plugin and config-file-provider ? pipeline-maven-plugin: 3.10.0 config-file-provider: 3.8.2 In the sample you shared you configured the settings as Default global settings provider in the tools configuration ? No as Default settings provider ? According to how I interpreted this plugin's documentation, the only "default" thing the plugin will fall back on when calling withMaven()  without specifying additional (optional) parameters is the "global" one.  But that could just be missing documentation. In any case, I've tried it with global only, user only and both.  I get the same results all three ways.  In the example output above, I had both specified with the same information in both managed files as a desperate attempt to debug this issue by trial and error.  The plugin output in the logs didn't even mention the user config. [2021-12-16T14:41:48.652Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.myinternal.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.myinternal.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'] Note that the "global" settings are mentioned (with credentials even being correctly called out) but the "user" settings are entirely ignored even though (by Maven design) the "user" settings should override the "global" settings.  Nevertheless, I assumed this was by plugin design since the documentation more or less says as much. In any case, even though that log line clearly states that it found the settings and parsed them (including credentials), nothing actually shows up in the effective settings inside withMaven() execution scope.
          robross0606 Robert made changes -
          Attachment image-2021-12-17-09-26-37-347.png [ 56965 ]
          Hide
          robross0606 Robert added a comment - - edited

          I should also mention that the problem definitely extends beyond just help:effective-settings.  The real world use case is that our internal artifact repository is not accessible because distributionManagement does not have authentication credentials. I can work around this by directly using config-file-provider (just like red der), but this entirely negates my purpose for using pipeline-maven-plugin.

          Show
          robross0606 Robert added a comment - - edited I should also mention that the problem definitely extends beyond just help:effective-settings .  The real world use case is that our internal artifact repository is not accessible because distributionManagement does not have authentication credentials. I can work around this by directly using config-file-provider (just like red der ), but this entirely negates my purpose for using pipeline-maven-plugin.
          Hide
          robross0606 Robert added a comment -

          I've also tried all three variations with "Replace All" enabled and disabled.  It had no discernable difference on the outcome.

          Show
          robross0606 Robert added a comment - I've also tried all three variations with "Replace All" enabled and disabled.  It had no discernable difference on the outcome.
          Hide
          robross0606 Robert added a comment - - edited

          FYI, I just tried again with only "Default settings provider" specified in the Global Tools Configuration and the log output indicates that it found no settings at all.  This leads me to believe my interpretation of the plugin documentation is correct and it does not pull in "Default settings provider" from Global Tools Configuration at all.  Only "global settings provider".

          Show
          robross0606 Robert added a comment - - edited FYI, I just tried again with only "Default settings provider" specified in the Global Tools Configuration and the log output indicates that it found no settings at all.  This leads me to believe my interpretation of the plugin documentation is correct and it does not pull in "Default settings provider" from Global Tools Configuration at all.  Only "global settings provider".
          Hide
          robross0606 Robert added a comment - - edited

          I believe this is somehow related to JENKINS-43651. Note the slightly larger logged information when this doesn't work:

          [Pipeline] {
          [Pipeline] withMaven
          [2022-01-17T15:04:43.074Z] [withMaven] Options: []
          [2022-01-17T15:04:43.081Z] [withMaven] Available options: 
          [2022-01-17T15:04:43.081Z] [withMaven] using JDK installation provided by the build agent
          [2022-01-17T15:04:44.027Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false): [mavenServerId: 'com.mycompany.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.mycompany.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']
          [2022-01-17T15:04:44.036Z] $ /bin/sh -c "which mvn"
          [2022-01-17T15:04:44.050Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace.
          [Pipeline] {
          [Pipeline] sh
          [2022-01-17T15:04:44.438Z] + mvn help:effective-settings
          [2022-01-17T15:04:44.438Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7" 
          [2022-01-17T15:04:46.922Z] [INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7/maven-spy-20220117-150446-38215226537671442746533.log.tmp ...
          [2022-01-17T15:04:46.922Z] [INFO] Scanning for projects...
          [2022-01-17T15:04:47.472Z] [INFO] 
          [2022-01-17T15:04:47.473Z] [INFO] ------------------< com.mycompany.ncp:log-client-java >-------------------
          [2022-01-17T15:04:47.473Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT
          [2022-01-17T15:04:47.473Z] [INFO] --------------------------------[ jar ]---------------------------------
          [2022-01-17T15:04:47.473Z] [INFO] 
          [2022-01-17T15:04:47.473Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings (default-cli) @ log-client-java ---
          [2022-01-17T15:04:48.816Z] [INFO] 
          [2022-01-17T15:04:48.816Z] Effective user-specific configuration settings:
          [2022-01-17T15:04:48.816Z] 
          [2022-01-17T15:04:48.816Z] <?xml version="1.0" encoding="UTF-8"?>
          [2022-01-17T15:04:48.816Z] <!-- ====================================================================== -->
          [2022-01-17T15:04:48.816Z] <!--                                                                        -->
          [2022-01-17T15:04:48.816Z] <!-- Generated by Maven Help Plugin on 2022-01-17T15:04:48Z                 -->
          [2022-01-17T15:04:48.816Z] <!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
          [2022-01-17T15:04:48.816Z] <!--                                                                        -->
          [2022-01-17T15:04:48.816Z] <!-- ====================================================================== -->
          [2022-01-17T15:04:48.816Z] <!-- ====================================================================== -->
          [2022-01-17T15:04:48.816Z] <!--                                                                        -->
          [2022-01-17T15:04:48.816Z] <!-- Effective Settings for 'jenkins' on 'ip-10-0-0-105'                    -->
          [2022-01-17T15:04:48.816Z] <!--                                                                        -->
          [2022-01-17T15:04:48.816Z] <!-- ====================================================================== -->
          [2022-01-17T15:04:48.816Z] <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
          [2022-01-17T15:04:48.816Z]   <localRepository>/var/lib/jenkins/.m2/repository</localRepository>
          [2022-01-17T15:04:48.816Z]   <pluginGroups>
          [2022-01-17T15:04:48.816Z]     <pluginGroup>org.apache.maven.plugins</pluginGroup>
          [2022-01-17T15:04:48.816Z]     <pluginGroup>org.codehaus.mojo</pluginGroup>
          [2022-01-17T15:04:48.816Z]   </pluginGroups>
          [2022-01-17T15:04:48.816Z] </settings>
          [2022-01-17T15:04:48.816Z] 
          [2022-01-17T15:04:48.816Z] 
          

          In this logged data, the following line jumped out:

          [2022-01-17T15:04:44.050Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace.
          

          However, my declarative pipeline has this already:

            tools {
              maven 'Maven_3.6.0'
              jdk 'jdk11'
            }
          

          Both of those tools are confirmed configured properly in Global Tools settings:

          On a hunch, I tried doing this in withMaven:

           stage('Debug') {
                steps {
                  withMaven(maven: 'Maven_3.6.0') {
                    sh 'mvn help:effective-settings'
                  }
                }
              }
          

          And suddenly:

          [Pipeline] {
          [Pipeline] withMaven
          [2022-01-17T15:09:52.843Z] [withMaven] Options: []
          [2022-01-17T15:09:52.843Z] [withMaven] Available options: 
          [2022-01-17T15:09:52.843Z] [withMaven] using JDK installation provided by the build agent
          [2022-01-17T15:09:52.854Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: true): [mavenServerId: 'com.mycompany.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.mycompany.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl']
          [2022-01-17T15:09:52.856Z] [withMaven] using Maven installation 'Maven_3.6.0'
          [Pipeline] {
          [Pipeline] sh
          [2022-01-17T15:09:53.145Z] + mvn help:effective-settings
          [2022-01-17T15:09:53.145Z] ----- withMaven Wrapper script -----
          [2022-01-17T15:09:53.145Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c" 
          [2022-01-17T15:09:53.397Z] Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
          [2022-01-17T15:09:53.397Z] Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0
          [2022-01-17T15:09:53.397Z] Java version: 11.0.2, vendor: Oracle Corporation, runtime: /var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2
          [2022-01-17T15:09:53.397Z] Default locale: en_US, platform encoding: UTF-8
          [2022-01-17T15:09:53.397Z] OS name: "linux", version: "4.14.252-131.483.amzn1.x86_64", arch: "amd64", family: "unix"
          [2022-01-17T15:09:54.751Z] [INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c/maven-spy-20220117-150954-550586148237436508350.log.tmp ...
          [2022-01-17T15:09:55.001Z] [INFO] Scanning for projects...
          [2022-01-17T15:09:55.552Z] [INFO] 
          [2022-01-17T15:09:55.552Z] [INFO] ------------------< com.mycompany.ncp:log-client-java >-------------------
          [2022-01-17T15:09:55.552Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT
          [2022-01-17T15:09:55.552Z] [INFO] --------------------------------[ jar ]---------------------------------
          [2022-01-17T15:09:55.552Z] [INFO] 
          [2022-01-17T15:09:55.552Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings (default-cli) @ log-client-java ---
          [2022-01-17T15:09:56.103Z] [INFO] 
          [2022-01-17T15:09:56.103Z] Effective user-specific configuration settings:
          [2022-01-17T15:09:56.103Z] 
          [2022-01-17T15:09:56.103Z] <?xml version="1.0" encoding="UTF-8"?>
          [2022-01-17T15:09:56.103Z] <!-- ====================================================================== -->
          [2022-01-17T15:09:56.103Z] <!--                                                                        -->
          [2022-01-17T15:09:56.103Z] <!-- Generated by Maven Help Plugin on 2022-01-17T15:09:55Z                 -->
          [2022-01-17T15:09:56.103Z] <!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
          [2022-01-17T15:09:56.103Z] <!--                                                                        -->
          [2022-01-17T15:09:56.103Z] <!-- ====================================================================== -->
          [2022-01-17T15:09:56.103Z] <!-- ====================================================================== -->
          [2022-01-17T15:09:56.103Z] <!--                                                                        -->
          [2022-01-17T15:09:56.103Z] <!-- Effective Settings for 'jenkins' on 'ip-10-0-0-105'                    -->
          [2022-01-17T15:09:56.103Z] <!--                                                                        -->
          [2022-01-17T15:09:56.103Z] <!-- ====================================================================== -->
          [2022-01-17T15:09:56.103Z] <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
          [2022-01-17T15:09:56.103Z]   <localRepository>/var/lib/jenkins/.m2/repository</localRepository>
          [2022-01-17T15:09:56.103Z]   <interactiveMode>false</interactiveMode>
          [2022-01-17T15:09:56.103Z]   <servers>
          [2022-01-17T15:09:56.103Z]     <server>
          [2022-01-17T15:09:56.103Z]       <username>ci</username>
          [2022-01-17T15:09:56.103Z]       <password>***</password>
          [2022-01-17T15:09:56.103Z]       <id>com.mycompany.repo.snapshots</id>
          [2022-01-17T15:09:56.103Z]     </server>
          [2022-01-17T15:09:56.103Z]     <server>
          [2022-01-17T15:09:56.103Z]       <username>ci</username>
          [2022-01-17T15:09:56.103Z]       <password>***</password>
          [2022-01-17T15:09:56.103Z]       <id>com.mycompany.repo.releases</id>
          [2022-01-17T15:09:56.103Z]     </server>
          [2022-01-17T15:09:56.103Z]   </servers>
          [2022-01-17T15:09:56.103Z]   <profiles>
          [2022-01-17T15:09:56.104Z]     <profile>
          [2022-01-17T15:09:56.104Z]       <repositories>
          [2022-01-17T15:09:56.104Z]         <repository>
          [2022-01-17T15:09:56.104Z]           <releases>
          [2022-01-17T15:09:56.104Z]             <enabled>false</enabled>
          [2022-01-17T15:09:56.104Z]           </releases>
          [2022-01-17T15:09:56.104Z]           <snapshots />
          [2022-01-17T15:09:56.104Z]           <id>com.mycompany.repo.snapshots</id>
          [2022-01-17T15:09:56.104Z]           <name>mycompany Snapshots</name>
          [2022-01-17T15:09:56.104Z]           <url>https://artifact.mycompanyinternal.com/repository/maven-snapshots</url>
          [2022-01-17T15:09:56.104Z]         </repository>
          [2022-01-17T15:09:56.104Z]         <repository>
          [2022-01-17T15:09:56.104Z]           <releases />
          [2022-01-17T15:09:56.104Z]           <snapshots>
          [2022-01-17T15:09:56.104Z]             <enabled>false</enabled>
          [2022-01-17T15:09:56.104Z]           </snapshots>
          [2022-01-17T15:09:56.104Z]           <id>com.mycompany.repo.releases</id>
          [2022-01-17T15:09:56.104Z]           <name>mycompany Releases</name>
          [2022-01-17T15:09:56.104Z]           <url>https://artifact.mycompanyinternal.com/repository/maven-releases</url>
          [2022-01-17T15:09:56.104Z]         </repository>
          [2022-01-17T15:09:56.104Z]       </repositories>
          [2022-01-17T15:09:56.104Z]     </profile>
          [2022-01-17T15:09:56.104Z]   </profiles>
          [2022-01-17T15:09:56.104Z]   <activeProfiles>
          [2022-01-17T15:09:56.104Z]     <activeProfile>default</activeProfile>
          [2022-01-17T15:09:56.104Z]   </activeProfiles>
          [2022-01-17T15:09:56.104Z]   <pluginGroups>
          [2022-01-17T15:09:56.104Z]     <pluginGroup>org.apache.maven.plugins</pluginGroup>
          [2022-01-17T15:09:56.104Z]     <pluginGroup>org.codehaus.mojo</pluginGroup>
          [2022-01-17T15:09:56.104Z]   </pluginGroups>
          [2022-01-17T15:09:56.104Z] </settings>
          

          So, for whatever reason, withMaven is not using the maven tool declared on the agent which, in turn, prevents it from using the configured settings.

          Show
          robross0606 Robert added a comment - - edited I believe this is somehow related to JENKINS-43651 . Note the slightly larger logged information when this doesn't work: [Pipeline] { [Pipeline] withMaven [2022-01-17T15:04:43.074Z] [withMaven] Options: [] [2022-01-17T15:04:43.081Z] [withMaven] Available options: [2022-01-17T15:04:43.081Z] [withMaven] using JDK installation provided by the build agent [2022-01-17T15:04:44.027Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: false ): [mavenServerId: 'com.mycompany.repo.releases' , jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6' , username: 'ci' , type: 'UsernamePasswordCredentialsImpl' ], [mavenServerId: 'com.mycompany.repo.snapshots' , jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6' , username: 'ci' , type: 'UsernamePasswordCredentialsImpl' ] [2022-01-17T15:04:44.036Z] $ /bin/sh -c "which mvn" [2022-01-17T15:04:44.050Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace. [Pipeline] { [Pipeline] sh [2022-01-17T15:04:44.438Z] + mvn help:effective-settings [2022-01-17T15:04:44.438Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext. class. path= "/ var /lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder= "/ var /lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7" [2022-01-17T15:04:46.922Z] [INFO] [jenkins-event-spy] Generate / var /lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven4d6d91f7/maven-spy-20220117-150446-38215226537671442746533.log.tmp ... [2022-01-17T15:04:46.922Z] [INFO] Scanning for projects... [2022-01-17T15:04:47.472Z] [INFO] [2022-01-17T15:04:47.473Z] [INFO] ------------------< com.mycompany.ncp:log-client-java >------------------- [2022-01-17T15:04:47.473Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT [2022-01-17T15:04:47.473Z] [INFO] --------------------------------[ jar ]--------------------------------- [2022-01-17T15:04:47.473Z] [INFO] [2022-01-17T15:04:47.473Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings ( default -cli) @ log-client-java --- [2022-01-17T15:04:48.816Z] [INFO] [2022-01-17T15:04:48.816Z] Effective user-specific configuration settings: [2022-01-17T15:04:48.816Z] [2022-01-17T15:04:48.816Z] <?xml version= "1.0" encoding= "UTF-8" ?> [2022-01-17T15:04:48.816Z] <!-- ====================================================================== --> [2022-01-17T15:04:48.816Z] <!-- --> [2022-01-17T15:04:48.816Z] <!-- Generated by Maven Help Plugin on 2022-01-17T15:04:48Z --> [2022-01-17T15:04:48.816Z] <!-- See: http: //maven.apache.org/plugins/maven-help-plugin/ --> [2022-01-17T15:04:48.816Z] <!-- --> [2022-01-17T15:04:48.816Z] <!-- ====================================================================== --> [2022-01-17T15:04:48.816Z] <!-- ====================================================================== --> [2022-01-17T15:04:48.816Z] <!-- --> [2022-01-17T15:04:48.816Z] <!-- Effective Settings for 'jenkins' on 'ip-10-0-0-105' --> [2022-01-17T15:04:48.816Z] <!-- --> [2022-01-17T15:04:48.816Z] <!-- ====================================================================== --> [2022-01-17T15:04:48.816Z] <settings xmlns= "http: //maven.apache.org/SETTINGS/1.1.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" > [2022-01-17T15:04:48.816Z] <localRepository>/ var /lib/jenkins/.m2/repository</localRepository> [2022-01-17T15:04:48.816Z] <pluginGroups> [2022-01-17T15:04:48.816Z] <pluginGroup>org.apache.maven.plugins</pluginGroup> [2022-01-17T15:04:48.816Z] <pluginGroup>org.codehaus.mojo</pluginGroup> [2022-01-17T15:04:48.816Z] </pluginGroups> [2022-01-17T15:04:48.816Z] </settings> [2022-01-17T15:04:48.816Z] [2022-01-17T15:04:48.816Z] In this logged data, the following line jumped out: [2022-01-17T15:04:44.050Z] [withMaven] Maven installation not specified in the 'withMaven()' step and not found on the build agent but 'mvnw' script found in the workspace. However, my declarative pipeline has this already: tools { maven 'Maven_3.6.0' jdk 'jdk11' } Both of those tools are confirmed configured properly in Global Tools settings: On a hunch, I tried doing this in withMaven : stage( 'Debug' ) { steps { withMaven(maven: 'Maven_3.6.0' ) { sh 'mvn help:effective-settings' } } } And suddenly: [Pipeline] { [Pipeline] withMaven [2022-01-17T15:09:52.843Z] [withMaven] Options: [] [2022-01-17T15:09:52.843Z] [withMaven] Available options: [2022-01-17T15:09:52.843Z] [withMaven] using JDK installation provided by the build agent [2022-01-17T15:09:52.854Z] [withMaven] using Maven global settings.xml 'global-maven-settings' with Maven servers credentials provided by Jenkins (replaceAll: true): [mavenServerId: 'com.mycompany.repo.releases', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'], [mavenServerId: 'com.mycompany.repo.snapshots', jenkinsCredentials: '7ad2488b-6087-4727-a1ca-6b9ced57baa6', username: 'ci', type: 'UsernamePasswordCredentialsImpl'] [2022-01-17T15:09:52.856Z] [withMaven] using Maven installation 'Maven_3.6.0' [Pipeline] { [Pipeline] sh [2022-01-17T15:09:53.145Z] + mvn help:effective-settings [2022-01-17T15:09:53.145Z] ----- withMaven Wrapper script ----- [2022-01-17T15:09:53.145Z] Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c" [2022-01-17T15:09:53.397Z] Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z) [2022-01-17T15:09:53.397Z] Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0 [2022-01-17T15:09:53.397Z] Java version: 11.0.2, vendor: Oracle Corporation, runtime: /var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2 [2022-01-17T15:09:53.397Z] Default locale: en_US, platform encoding: UTF-8 [2022-01-17T15:09:53.397Z] OS name: "linux", version: "4.14.252-131.483.amzn1.x86_64", arch: "amd64", family: "unix" [2022-01-17T15:09:54.751Z] [INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/NL_log-client-java_PR-25@tmp/withMaven26bf946c/maven-spy-20220117-150954-550586148237436508350.log.tmp ... [2022-01-17T15:09:55.001Z] [INFO] Scanning for projects... [2022-01-17T15:09:55.552Z] [INFO] [2022-01-17T15:09:55.552Z] [INFO] ------------------< com.mycompany.ncp:log-client-java >------------------- [2022-01-17T15:09:55.552Z] [INFO] Building Log Client for Java 1.2.1-SNAPSHOT [2022-01-17T15:09:55.552Z] [INFO] --------------------------------[ jar ]--------------------------------- [2022-01-17T15:09:55.552Z] [INFO] [2022-01-17T15:09:55.552Z] [INFO] --- maven-help-plugin:3.2.0:effective-settings (default-cli) @ log-client-java --- [2022-01-17T15:09:56.103Z] [INFO] [2022-01-17T15:09:56.103Z] Effective user-specific configuration settings: [2022-01-17T15:09:56.103Z] [2022-01-17T15:09:56.103Z] <?xml version="1.0" encoding="UTF-8"?> [2022-01-17T15:09:56.103Z] <!-- ====================================================================== --> [2022-01-17T15:09:56.103Z] <!-- --> [2022-01-17T15:09:56.103Z] <!-- Generated by Maven Help Plugin on 2022-01-17T15:09:55Z --> [2022-01-17T15:09:56.103Z] <!-- See: http://maven.apache.org/plugins/maven-help-plugin/ --> [2022-01-17T15:09:56.103Z] <!-- --> [2022-01-17T15:09:56.103Z] <!-- ====================================================================== --> [2022-01-17T15:09:56.103Z] <!-- ====================================================================== --> [2022-01-17T15:09:56.103Z] <!-- --> [2022-01-17T15:09:56.103Z] <!-- Effective Settings for 'jenkins' on 'ip-10-0-0-105' --> [2022-01-17T15:09:56.103Z] <!-- --> [2022-01-17T15:09:56.103Z] <!-- ====================================================================== --> [2022-01-17T15:09:56.103Z] <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> [2022-01-17T15:09:56.103Z] <localRepository>/var/lib/jenkins/.m2/repository</localRepository> [2022-01-17T15:09:56.103Z] <interactiveMode>false</interactiveMode> [2022-01-17T15:09:56.103Z] <servers> [2022-01-17T15:09:56.103Z] <server> [2022-01-17T15:09:56.103Z] <username>ci</username> [2022-01-17T15:09:56.103Z] <password>***</password> [2022-01-17T15:09:56.103Z] <id>com.mycompany.repo.snapshots</id> [2022-01-17T15:09:56.103Z] </server> [2022-01-17T15:09:56.103Z] <server> [2022-01-17T15:09:56.103Z] <username>ci</username> [2022-01-17T15:09:56.103Z] <password>***</password> [2022-01-17T15:09:56.103Z] <id>com.mycompany.repo.releases</id> [2022-01-17T15:09:56.103Z] </server> [2022-01-17T15:09:56.103Z] </servers> [2022-01-17T15:09:56.103Z] <profiles> [2022-01-17T15:09:56.104Z] <profile> [2022-01-17T15:09:56.104Z] <repositories> [2022-01-17T15:09:56.104Z] <repository> [2022-01-17T15:09:56.104Z] <releases> [2022-01-17T15:09:56.104Z] <enabled>false</enabled> [2022-01-17T15:09:56.104Z] </releases> [2022-01-17T15:09:56.104Z] <snapshots /> [2022-01-17T15:09:56.104Z] <id>com.mycompany.repo.snapshots</id> [2022-01-17T15:09:56.104Z] <name>mycompany Snapshots</name> [2022-01-17T15:09:56.104Z] <url>https://artifact.mycompanyinternal.com/repository/maven-snapshots</url> [2022-01-17T15:09:56.104Z] </repository> [2022-01-17T15:09:56.104Z] <repository> [2022-01-17T15:09:56.104Z] <releases /> [2022-01-17T15:09:56.104Z] <snapshots> [2022-01-17T15:09:56.104Z] <enabled>false</enabled> [2022-01-17T15:09:56.104Z] </snapshots> [2022-01-17T15:09:56.104Z] <id>com.mycompany.repo.releases</id> [2022-01-17T15:09:56.104Z] <name>mycompany Releases</name> [2022-01-17T15:09:56.104Z] <url>https://artifact.mycompanyinternal.com/repository/maven-releases</url> [2022-01-17T15:09:56.104Z] </repository> [2022-01-17T15:09:56.104Z] </repositories> [2022-01-17T15:09:56.104Z] </profile> [2022-01-17T15:09:56.104Z] </profiles> [2022-01-17T15:09:56.104Z] <activeProfiles> [2022-01-17T15:09:56.104Z] <activeProfile>default</activeProfile> [2022-01-17T15:09:56.104Z] </activeProfiles> [2022-01-17T15:09:56.104Z] <pluginGroups> [2022-01-17T15:09:56.104Z] <pluginGroup>org.apache.maven.plugins</pluginGroup> [2022-01-17T15:09:56.104Z] <pluginGroup>org.codehaus.mojo</pluginGroup> [2022-01-17T15:09:56.104Z] </pluginGroups> [2022-01-17T15:09:56.104Z] </settings> So, for whatever reason, withMaven is not using the maven tool declared on the agent which, in turn, prevents it from using the configured settings.
          robross0606 Robert made changes -
          Attachment image-2022-01-17-10-32-27-333.png [ 57109 ]
          Hide
          robross0606 Robert added a comment - - edited

          Just in case this detail matters, our pipeline is being managed and triggered via the Bitbucket Branch Source Plugin.  We also echo all environment variables to logs in a previous stage and see this well before using withMaven:

          [2022-01-17T15:29:13.376Z] M2_HOME=/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0
          [2022-01-17T15:29:13.376Z] MAVEN_HOME=/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0
          [2022-01-17T15:29:13.376Z] PATH=/var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2/bin:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0/bin:/var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2/bin:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0/bin:/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin/
          
          Show
          robross0606 Robert added a comment - - edited Just in case this detail matters, our pipeline is being managed and triggered via the Bitbucket Branch Source Plugin.  We also echo all environment variables to logs in a previous stage and see this well before using withMaven : [2022-01-17T15:29:13.376Z] M2_HOME=/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0 [2022-01-17T15:29:13.376Z] MAVEN_HOME=/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0 [2022-01-17T15:29:13.376Z] PATH=/var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2/bin:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0/bin:/var/lib/jenkins/tools/hudson.model.JDK/jdk11/jdk-11.0.2/bin:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.6.0/bin:/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin/

            People

            Assignee:
            cleclerc Cyrille Le Clerc
            Reporter:
            red888 red der
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: