• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • build-user-vars-plugin
    • None
    • Jenkins 1.527
      Build User Vars Plugin 1.1

      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.

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

          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

          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

          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!

          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!

          Clifford Sanders added a comment - I have created a pull request: https://github.com/jenkinsci/build-user-vars-plugin/pull/3

          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

          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

          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

          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

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

              Created:
              Updated:
              Resolved: