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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          imod 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: Cyrille Le Clerc

          Show
          imod 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: Cyrille Le Clerc
          Hide
          cleclerc 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.

          Show
          cleclerc 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.
          Hide
          lautou 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."

          Show
          lautou 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."
          Hide
          cleclerc 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).

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

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

          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.

          Show
          cleclerc 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). Laurent TOURREAU would this clarification be enough for the moment? Later, I would like to review the naming convention of pipeline attributes with Jesse Glick and jenkins-dev. Longer term: I am not clear if the pipeline attributes that refers to "ids" should be suffixed by "Id". /cc Alvaro Lobato 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.
          Hide
          lautou 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).

          Show
          lautou 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).
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Thanks Laurent TOURREAU, I fixed the typo

          Show
          cleclerc Cyrille Le Clerc added a comment - Thanks Laurent TOURREAU , I fixed the typo

            People

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

              Dates

              Created:
              Updated:
              Resolved: