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

Pipeline Maven Plugin : globalMavenSettingsConfig argument doesn't get configuration file name but ID

      I added a Global Maven setttings.xml in configuration file provider and named it : my-maven-global-settings.
      When using Maven Pipeline withMaven clause, it ignores the name provided as globalMavenSettingsConfig argument:

      withMaven(
           maven: "maven-3.3.9",
           globalMavenSettingsConfig: "my-maven-global-settings"
      ) {
      ...
      }
      

      The build because it cannot find settings.xml

      As workaround I have to specify config file ID instead:

      withMaven(
           maven: "maven-3.3.9",
           globalMavenSettingsConfig: "2bde3e90-eada-4573-9a33-bfeb95135d97"
      ) {
      ...
      }
      

      It works

          [JENKINS-41265] Pipeline Maven Plugin : globalMavenSettingsConfig argument doesn't get configuration file name but ID

          I would say this is by design... but I let this to one of the authors of the pipeline-maven plugin: cleclerc

          Dominik Bartholdi added a comment - I would say this is by design... but I let this to one of the authors of the pipeline-maven plugin: cleclerc

          It is by design that the "withMaven" pipeline step relies on the "id" of the configuration file and NOT on its name. We have chosen this by consistency with other pipeline steps (e.g. the "git" step uses credentials ids).

          We are aware that the migration can be cumbersome (it has been for us, I did it for several CloudBees servers) but we ask people who adopt the "withMaven()" pipeline wrapper to replace ther configuration files with random IDs by configuration files with human readable ids.

          Cyrille Le Clerc added a comment - It is by design that the " withMaven " pipeline step relies on the "id" of the configuration file and NOT on its name. We have chosen this by consistency with other pipeline steps (e.g. the "git" step uses credentials ids). We are aware that the migration can be cumbersome (it has been for us, I did it for several CloudBees servers) but we ask people who adopt the " withMaven() " pipeline wrapper to replace ther configuration files with random IDs by configuration files with human readable ids.

          It should be more consistent to rename the argument globalMavenSettingsConfigId instead of globalMavenSettingsConfig.

          Or the doc should be clearer for this point:
          https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin

          "Maven Global Settings Config (globalMavenSettingsConfig): Select a global Maven settings file *ID *from Config File Provider Plugin."

          Laurent TOURREAU added a comment - It should be more consistent to rename the argument globalMavenSettingsConfigId instead of globalMavenSettingsConfig. Or the doc should be clearer for this point: https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin "Maven Global Settings Config (globalMavenSettingsConfig): Select a global Maven settings file *ID *from Config File Provider Plugin."

          Cyrille Le Clerc added a comment - - edited

          I understand the "misunderstanding", we primarily used the feature going through the snippet generator. I have updated the plugin documentation as you have suggested and I have added an addition note:

          globalMavenSettingsConfig and globalMavenSettingsConfig use the ID, not the name of the Maven settings file (resp Maven Global Settings file).

          lautou would this clarification be enough for the moment?
          Later, I would like to review the naming convention of pipeline attributes with jglick and jenkins-dev.

          Longer term: I am not clear if the pipeline attributes that refers to "ids" should be suffixed by "Id". /cc alobato

          This seem to be the convention (configFileProvider, git...) and we may have to deprecate globalMavenSettingsConfig and globalMavenSettingsConfig in favor of globalMavenSettingsConfigId and globalMavenSettingsConfigId.
          Then we should re discuss the choice for the naming of the maven and jdk attributes.

          Cyrille Le Clerc added a comment - - edited I understand the "misunderstanding", we primarily used the feature going through the snippet generator. I have updated the plugin documentation as you have suggested and I have added an addition note: globalMavenSettingsConfig and globalMavenSettingsConfig use the ID , not the name of the Maven settings file (resp Maven Global Settings file). lautou would this clarification be enough for the moment? Later, I would like to review the naming convention of pipeline attributes with jglick and jenkins-dev. Longer term: I am not clear if the pipeline attributes that refers to "ids" should be suffixed by "Id". /cc alobato This seem to be the convention (configFileProvider, git...) and we may have to deprecate globalMavenSettingsConfig and globalMavenSettingsConfig in favor of globalMavenSettingsConfigId and globalMavenSettingsConfigId . Then we should re discuss the choice for the naming of the maven and jdk attributes.

          @Cyrille. Since you have updated the docs, it is enough for me. Thanks for your clarification.

          Small typo on your answer:
          globalMavenSettingsConfig and mavenSettingsConfig use the ID, not the name of the Maven settings file (resp Maven Global Settings file).

          Laurent TOURREAU added a comment - @Cyrille. Since you have updated the docs, it is enough for me. Thanks for your clarification. Small typo on your answer: globalMavenSettingsConfig and mavenSettingsConfig use the ID, not the name of the Maven settings file (resp Maven Global Settings file).

          Thanks lautou, I fixed the typo

          Cyrille Le Clerc added a comment - Thanks lautou , I fixed the typo

            cleclerc Cyrille Le Clerc
            lautou Laurent TOURREAU
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: