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

User variables are not set to Maven3 build

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: build-user-vars-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.527
      Build User Vars Plugin 1.1
    • Similar Issues:

      Description

      We use free style project and Maven projects in Jenkins.
      If I configure free style project to using user variables from Jenkins, it works.
      But for Maven projects values are not propageted to environment or system properties of launched Maven execution.

        Attachments

          Activity

          Hide
          petrprochy Petr Prochazka added a comment -

          I create local hot fix of plugin.
          Problem was that for Maven projects set of variables never call. I modified method setUp() of class:

          BuildUser
          public class BuildUser extends BuildWrapper {
            @SuppressWarnings("rawtypes")
            @Override
            public Environment setUp(final AbstractBuild build, Launcher launcher, BuildListener listener)
                throws IOException, InterruptedException {
              /* noop */
              return new Environment() {
                @Override
                public void buildEnvVars(Map<String, String> env) {
                  makeUserBuildVariables(build, env);
                }
              };
            }
          }

          and this change works.
          But I don't known if this fix is correct. I can create pull request in Git repository for this plugin.

          Thanks for reply

          Show
          petrprochy Petr Prochazka added a comment - I create local hot fix of plugin. Problem was that for Maven projects set of variables never call. I modified method setUp() of class: BuildUser public class BuildUser extends BuildWrapper { @SuppressWarnings( "rawtypes" ) @Override public Environment setUp( final AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { /* noop */ return new Environment() { @Override public void buildEnvVars(Map< String , String > env) { makeUserBuildVariables(build, env); } }; } } and this change works. But I don't known if this fix is correct. I can create pull request in Git repository for this plugin. Thanks for reply
          Hide
          ahammar Anders Hammar added a comment -

          I've run into the same problem for Maven build projects. I solved it by adding yet another plugin and have it injecting the environment variables. Not a pretty solution though. If the suggested solution for this plugin is correct, it would be great to have a new release out!

          Show
          ahammar Anders Hammar added a comment - I've run into the same problem for Maven build projects. I solved it by adding yet another plugin and have it injecting the environment variables. Not a pretty solution though. If the suggested solution for this plugin is correct, it would be great to have a new release out!
          Hide
          clifford_jenkins Clifford Sanders added a comment -
          Show
          clifford_jenkins Clifford Sanders added a comment - I have created a pull request: https://github.com/jenkinsci/build-user-vars-plugin/pull/3
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Clifford Sanders
          Path:
          src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java
          http://jenkins-ci.org/commit/build-user-vars-plugin/1984212a790660bfde9410f27394ce359077eb76
          Log:
          [FIXED JENKINS-19187] User variables are not set to Maven3 build

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Clifford Sanders Path: src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java http://jenkins-ci.org/commit/build-user-vars-plugin/1984212a790660bfde9410f27394ce359077eb76 Log: [FIXED JENKINS-19187] User variables are not set to Maven3 build
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Clifford Sanders
          Path:
          src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java
          http://jenkins-ci.org/commit/build-user-vars-plugin/61450e9337aaf55ecd280f03bc6473e076baf729
          Log:
          Merge pull request #3 from clifford-github/master

          [FIXED JENKINS-19187] User variables are not set to Maven3 build

          Compare: https://github.com/jenkinsci/build-user-vars-plugin/compare/0a44831b76cc...61450e9337aa

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Clifford Sanders Path: src/main/java/org/jenkinsci/plugins/builduser/BuildUser.java http://jenkins-ci.org/commit/build-user-vars-plugin/61450e9337aaf55ecd280f03bc6473e076baf729 Log: Merge pull request #3 from clifford-github/master [FIXED JENKINS-19187] User variables are not set to Maven3 build Compare: https://github.com/jenkinsci/build-user-vars-plugin/compare/0a44831b76cc...61450e9337aa

            People

            • Assignee:
              clifford_jenkins Clifford Sanders
              Reporter:
              petrprochy Petr Prochazka
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: