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

Maven build step fail to launch mvn process when special chars are present in build variables

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Maven build step put all build variables on command line as properties. This causes problems when special characters are used. This happens often when non-trivial label expressions are used: -Dlabel_exp=w2k8&&x86.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/tasks/Maven.java
            http://jenkins-ci.org/commit/jenkins/9e30f50065b8bb213c6571f325e5e1d5008281ce
            Log:
            [FIXED JENKINS-26684] Escape special chars in maven build step arguments

            (cherry picked from commit 58a41bcb182290de681da01ba277b5e0d6211707)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/tasks/Maven.java http://jenkins-ci.org/commit/jenkins/9e30f50065b8bb213c6571f325e5e1d5008281ce Log: [FIXED JENKINS-26684] Escape special chars in maven build step arguments (cherry picked from commit 58a41bcb182290de681da01ba277b5e0d6211707)
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #4292
            JENKINS-26684 Reproduce in unittest. (Revision 6e94ee3f5a620a2010dbbcf94eed1e834f1aa114)
            [FIXED JENKINS-26684] Escape special chars in maven build step arguments (Revision 9eaba2af9f0fa2649390f83b9b67fe6ee22fe1ad)

            Result = UNSTABLE
            ogondza : 6e94ee3f5a620a2010dbbcf94eed1e834f1aa114
            Files :

            • test/src/test/java/hudson/tasks/MavenTest.java

            ogondza : 9eaba2af9f0fa2649390f83b9b67fe6ee22fe1ad
            Files :

            • core/src/main/java/hudson/tasks/Maven.java
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #4292 JENKINS-26684 Reproduce in unittest. (Revision 6e94ee3f5a620a2010dbbcf94eed1e834f1aa114) [FIXED JENKINS-26684] Escape special chars in maven build step arguments (Revision 9eaba2af9f0fa2649390f83b9b67fe6ee22fe1ad) Result = UNSTABLE ogondza : 6e94ee3f5a620a2010dbbcf94eed1e834f1aa114 Files : test/src/test/java/hudson/tasks/MavenTest.java ogondza : 9eaba2af9f0fa2649390f83b9b67fe6ee22fe1ad Files : core/src/main/java/hudson/tasks/Maven.java
            Hide
            oberlies Tobias Oberlies added a comment -

            This change caused a regression in the Maven build step when used with the Gerrit trigger plugin. In Jenkins 1.580.3, a Gerrit event resulted in the following command (simplified):

            [workspace] $ D:\apache-maven-3.0.5\bin\mvn.bat -f gitRepo/pom.xml -DGERRIT_HOST=git.corp "-DGERRIT_EVENT_ACCOUNT_NAME=Max Mustermann" -DGERRIT_EVENT_TYPE=ref-updated '-DGERRIT_EVENT_ACCOUNT=\"Max Mustermann\" <max.mustermann@corp>' -B -V clean deploy sonar:sonar
            

            In Jenkins 1.609.3, the following command is executed instead:

            [workspace] $ cmd.exe /C '"D:\apache-maven-3.0.5\bin\mvn.bat -f gitRepo/pom.xml -DGERRIT_HOST=git.corp "-DGERRIT_EVENT_ACCOUNT_NAME=Max Mustermann" -DGERRIT_EVENT_TYPE=ref-updated "-DGERRIT_EVENT_ACCOUNT=\""Max Mustermann\"" <max.mustermann@corp>" -B -V clean deploy sonar:sonar && exit %%ERRORLEVEL%%"'
            

            This results a build error because one of the arguments is no longer quoted correctly:

            [ERROR] Unknown lifecycle phase "Mustermann"" <max.mustermann@corp>". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
            
            Show
            oberlies Tobias Oberlies added a comment - This change caused a regression in the Maven build step when used with the Gerrit trigger plugin. In Jenkins 1.580.3, a Gerrit event resulted in the following command (simplified): [workspace] $ D:\apache-maven-3.0.5\bin\mvn.bat -f gitRepo/pom.xml -DGERRIT_HOST=git.corp "-DGERRIT_EVENT_ACCOUNT_NAME=Max Mustermann" -DGERRIT_EVENT_TYPE=ref-updated '-DGERRIT_EVENT_ACCOUNT=\"Max Mustermann\" <max.mustermann@corp>' -B -V clean deploy sonar:sonar In Jenkins 1.609.3, the following command is executed instead: [workspace] $ cmd.exe /C '"D:\apache-maven-3.0.5\bin\mvn.bat -f gitRepo/pom.xml -DGERRIT_HOST=git.corp "-DGERRIT_EVENT_ACCOUNT_NAME=Max Mustermann" -DGERRIT_EVENT_TYPE=ref-updated "-DGERRIT_EVENT_ACCOUNT=\""Max Mustermann\"" <max.mustermann@corp>" -B -V clean deploy sonar:sonar && exit %%ERRORLEVEL%%"' This results a build error because one of the arguments is no longer quoted correctly: [ERROR] Unknown lifecycle phase "Mustermann"" <max.mustermann@corp>". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
            Hide
            vtintillier vtintillier added a comment -

            Not sure if this will help in your case, but I workaround this by unchecking the "Escape Quotes in Parameter Values" option in the Gerrit Trigger Advanced Options.

            Show
            vtintillier vtintillier added a comment - Not sure if this will help in your case, but I workaround this by unchecking the "Escape Quotes in Parameter Values" option in the Gerrit Trigger Advanced Options.
            Hide
            bardelotnzl Noël Bardelot added a comment -

            The regression mentionned by Tobias Oberlies seems to be broader than just the Gerrit Trigger plugin. Please see JENKINS-31986.

            As per Tobias' logs and mine, you can see the CMD execution runs with the command being both single-quoted and double-quoted:

            cmd.exe /C '"some command"'
            

            The double-quotes are clearly the issue here.

            Show
            bardelotnzl Noël Bardelot added a comment - The regression mentionned by Tobias Oberlies seems to be broader than just the Gerrit Trigger plugin. Please see JENKINS-31986 . As per Tobias' logs and mine, you can see the CMD execution runs with the command being both single-quoted and double-quoted: cmd.exe /C ' "some command" ' The double-quotes are clearly the issue here.

              People

              • Assignee:
                Unassigned
                Reporter:
                olivergondza Oliver Gondža
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: