• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Jenkins 2.60.3
      Pipeline Maven Integration 2.0.1
      mvn 3.5.3
    • pipeline-maven 3.10.0

      Expected behavior:

      In pipeline:

       

      withMaven(
       maven: mvnId, // Maven installation declared in the Jenkins "Global Tool Configuration"
       mavenSettingsConfig: mvnSettingsId, // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
       mavenLocalRepo: mavenLocalRepo
       )
      { 
         result = sh( 
            returnStdout: true, 
            script: 'mvn org.apache.maven.plugins:maven-help-plugin::evaluate -Dexpression=project.version -q -DforceStdout -B" ) 
      }
      

       

      Desired result variable value:

      1.5.0

       

      Actual result variable:

      ----- withMaven Wrapper script -----
       Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
       Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.3
       Java version: 1.8.0_161, vendor: Oracle Corporation
       Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
       Default locale: en_US, platform encoding: UTF-8
       OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"
       1.5.0

      Analysis:

      withMaven wrapper adds stdout info, that cannot be removed, disabled, according to source:

      https://github.com/jenkinsci/pipeline-maven-plugin/blob/b150161c91769de782af6c5b2ebe7907a4bd17b0/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java

      However, that breaks the way we gets output with mvn command.

      Workaround: specifically to maven-help-plugin, I can redirect output to a file, and readFile that.

      Long-term solution (exclusive choice):

      1. add a silent field to withMaven, to disable any output?
      2. add a showDebug field to show debug info
      3. do not show debug info, except when mvn command fails

      Thank you.

          [JENKINS-58425] withMaven prints debug log and pollutes

          Antoine Tran created issue -
          Antoine Tran made changes -
          Description Original: Expected behavior:

          In pipeline:

          withMaven(
           maven: mvnId, // Maven installation declared in the Jenkins "Global Tool Configuration"
           mavenSettingsConfig: mvnSettingsId, // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
           mavenLocalRepo: mavenLocalRepo
           ) {
           result = sh(
           returnStdout: true,
           script: 'mvn org.apache.maven.plugins:maven-help-plugin::evaluate -Dexpression=project.version -q -DforceStdout -B"
           )
           }

          result variable value is "1.5.0"

          Actual behavior:

          result variable is:

          "----- withMaven Wrapper script -----
          Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
          Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.3
          Java version: 1.8.0_161, vendor: Oracle Corporation
          Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
          Default locale: en_US, platform encoding: UTF-8
          OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"
          1.5.0"

          Analysis:

          withMaven wrapper adds stdout info, that cannot be removed, disabled, according to source:

          https://github.com/jenkinsci/pipeline-maven-plugin/blob/b150161c91769de782af6c5b2ebe7907a4bd17b0/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java

          However, that breaks the way we gets output with mvn command.

          Workaround: specifically to maven-help-plugin, I can redirect output to a file, and readFile that.

          Long-term solution (exclusive choice):

          1/ add a silent field to withMaven, to disable any output?

          2/ add a showDebug field to show debug info

          3/ do not show debug info, except when mvn command fails

          Thank you.
          New: Expected behavior:

          In pipeline:

           
          {code:java}
          withMaven(
           maven: mvnId, // Maven installation declared in the Jenkins "Global Tool Configuration"
           mavenSettingsConfig: mvnSettingsId, // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
           mavenLocalRepo: mavenLocalRepo
           )
          { result = sh( returnStdout: true, script: 'mvn org.apache.maven.plugins:maven-help-plugin::evaluate -Dexpression=project.version -q -DforceStdout -B" ) }
          {code}
           

          result variable value is "
          {noformat}
          1.5.0{noformat}
          "

          Actual behavior:

          result variable is:

          "
          {noformat}
          ----- withMaven Wrapper script -----
           Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
           Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.3
           Java version: 1.8.0_161, vendor: Oracle Corporation
           Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
           Default locale: en_US, platform encoding: UTF-8
           OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"
           1.5.0{noformat}
          "

          Analysis:

          withMaven wrapper adds stdout info, that cannot be removed, disabled, according to source:

          [https://github.com/jenkinsci/pipeline-maven-plugin/blob/b150161c91769de782af6c5b2ebe7907a4bd17b0/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java]

          However, that breaks the way we gets output with mvn command.

          Workaround: specifically to maven-help-plugin, I can redirect output to a file, and readFile that.

          Long-term solution (exclusive choice):
           # add a silent field to withMaven, to disable any output?
           # add a showDebug field to show debug info
           # do not show debug info, except when mvn command fails

          Thank you.
          Cyrille Le Clerc made changes -
          Description Original: Expected behavior:

          In pipeline:

           
          {code:java}
          withMaven(
           maven: mvnId, // Maven installation declared in the Jenkins "Global Tool Configuration"
           mavenSettingsConfig: mvnSettingsId, // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
           mavenLocalRepo: mavenLocalRepo
           )
          { result = sh( returnStdout: true, script: 'mvn org.apache.maven.plugins:maven-help-plugin::evaluate -Dexpression=project.version -q -DforceStdout -B" ) }
          {code}
           

          result variable value is "
          {noformat}
          1.5.0{noformat}
          "

          Actual behavior:

          result variable is:

          "
          {noformat}
          ----- withMaven Wrapper script -----
           Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
           Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.3
           Java version: 1.8.0_161, vendor: Oracle Corporation
           Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
           Default locale: en_US, platform encoding: UTF-8
           OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"
           1.5.0{noformat}
          "

          Analysis:

          withMaven wrapper adds stdout info, that cannot be removed, disabled, according to source:

          [https://github.com/jenkinsci/pipeline-maven-plugin/blob/b150161c91769de782af6c5b2ebe7907a4bd17b0/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java]

          However, that breaks the way we gets output with mvn command.

          Workaround: specifically to maven-help-plugin, I can redirect output to a file, and readFile that.

          Long-term solution (exclusive choice):
           # add a silent field to withMaven, to disable any output?
           # add a showDebug field to show debug info
           # do not show debug info, except when mvn command fails

          Thank you.
          New: Expected behavior:

          In pipeline:

           
          {code:java}
          withMaven(
           maven: mvnId, // Maven installation declared in the Jenkins "Global Tool Configuration"
           mavenSettingsConfig: mvnSettingsId, // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
           mavenLocalRepo: mavenLocalRepo
           )
          {
             result = sh(
                returnStdout: true,
                script: 'mvn org.apache.maven.plugins:maven-help-plugin::evaluate -Dexpression=project.version -q -DforceStdout -B" )
          }
          {code}
           

          Desired result variable value:
          {noformat}
          1.5.0{noformat}
           

          Actual result variable:
          {noformat}
          ----- withMaven Wrapper script -----
           Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
           Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.3
           Java version: 1.8.0_161, vendor: Oracle Corporation
           Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
           Default locale: en_US, platform encoding: UTF-8
           OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"
           1.5.0{noformat}
          Analysis:

          withMaven wrapper adds stdout info, that cannot be removed, disabled, according to source:

          [https://github.com/jenkinsci/pipeline-maven-plugin/blob/b150161c91769de782af6c5b2ebe7907a4bd17b0/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java]

          However, that breaks the way we gets output with mvn command.

          Workaround: specifically to maven-help-plugin, I can redirect output to a file, and readFile that.

          Long-term solution (exclusive choice):
           # add a silent field to withMaven, to disable any output?
           # add a showDebug field to show debug info
           # do not show debug info, except when mvn command fails

          Thank you.
          Garr made changes -
          Comment [ Is there a way around this? I'm even trying to log to a temporary file and I'm still seeing the stdout info. ]
          Arnaud Héritier made changes -
          Assignee Original: Alvaro Lobato [ alobato ]
          Arnaud Héritier made changes -
          Assignee New: Arnaud Héritier [ aheritier ]
          Arnaud Héritier made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Arnaud Héritier made changes -
          Released As New: pipeline-maven 3.10.0
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Fixed but Unreleased [ 10203 ]
          Arnaud Héritier made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]
          Benoit made changes -
          Link New: This issue relates to JENKINS-70543 [ JENKINS-70543 ]

            aheritier Arnaud Héritier
            antoinetran Antoine Tran
            Votes:
            5 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: