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

pipeline-maven: warning of unknown Maven version in plugin version 1368.vfb_8509d7b_869

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Jenkins LTS 2.426.2
      pipeline-maven 1368.vfb_8509d7b_869
      pipeline-maven-api 1368.vfb_8509d7b_869
    • 1376.v18876d10ce9c

      After updating the pipeline-maven and pipeline-maven-api plugin from version 1362.vee39a_d4b_02b_1 to version 1368.vfb_8509d7b_869, I can now see every time withMaven() is invoked a warning message in the job log:

      [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
      

      But withMaven seems to pickup the correct Maven version despite the warning:

      1) I have configured Maven tool "Maven 3.9.6" picking the version 3.9.6.

      2) The following pipeline:

      pipeline {  
        agent { node { label 'linux' } }
        stages { 
          stage('Maven') {
            steps {
                withMaven(maven: "Maven 3.9.6") {
                  sh "mvn -U -B -e -v"
               }
            }
          }
        } 
      } 
      

      creates the output

      [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
      + mvn -U -B -e -v
      Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/srv/jenkins-data/node/workspace/DOT-1949-mvn@tmp/withMavenbbe509b0/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/srv/jenkins-data/node/workspace/DOT-1949-mvn@tmp/withMavenbbe509b0"
      Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
      Maven home: /srv/jenkins-data/node/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.9.6
      Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-17-jdk
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "3.10.0-1160.105.1.el7.x86_64", arch: "amd64", family: "unix"
      Finished: SUCCESS 
      

       

      I reverted both plugins back to the previous version 1362.vee39a_d4b_02b_1 and the warning message is gone.

      Does not look like a critical issue, but having the warning now with every invocation of withMaven() is very irritating for the users.

          [JENKINS-72516] pipeline-maven: warning of unknown Maven version in plugin version 1368.vfb_8509d7b_869

          Rainer Montag added a comment -

          Running with traceability:true give some more information:

          [withMaven] Options: []
          [withMaven] Available options: 
          [withMaven] using JDK installation provided by the build agent
          [withMaven] using Maven installation 'Maven 3.9.6'
          [withMaven] failed to read Maven version: Unable to serialize Optional[Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)]
          [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
          ... 

          Rainer Montag added a comment - Running with traceability:true give some more information: [withMaven] Options: [] [withMaven] Available options: [withMaven] using JDK installation provided by the build agent [withMaven] using Maven installation 'Maven 3.9.6' [withMaven] failed to read Maven version: Unable to serialize Optional[Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)] [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x ...

          Same issue here

          [14:53:21.533+01:00] - [withMaven] failed to read Maven version: null
          [14:53:21.533+01:00] - [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
          

          But latest maven version is used on container (https://hub.docker.com/_/maven)

          [14:53:22.935+01:00] - ----- withMaven Wrapper script -----
          [14:53:22.935+01:00] - Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/home/jenkins/agent/workspace/*********@tmp/withMavenf2a92218/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/home/jenkins/agent/workspace/**********@tmp/withMavenf2a92218" 
          [14:53:23.564+01:00] - Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
          [14:53:23.565+01:00] - Maven home: /usr/share/maven
          

          Valentin Delaye added a comment - Same issue here [14:53:21.533+01:00] - [withMaven] failed to read Maven version: null [14:53:21.533+01:00] - [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x But latest maven version is used on container ( https://hub.docker.com/_/maven ) [14:53:22.935+01:00] - ----- withMaven Wrapper script ----- [14:53:22.935+01:00] - Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext. class. path= "/home/jenkins/agent/workspace/*********@tmp/withMavenf2a92218/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder= "/home/jenkins/agent/workspace/**********@tmp/withMavenf2a92218" [14:53:23.564+01:00] - Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) [14:53:23.565+01:00] - Maven home: /usr/share/maven

          Rainer Montag added a comment -

          bguerin can you have a look? It was introduced with https://github.com/jenkinsci/pipeline-maven-plugin/pull/749

          Rainer Montag added a comment - bguerin can you have a look? It was introduced with https://github.com/jenkinsci/pipeline-maven-plugin/pull/749

          Vilius added a comment - - edited

          The issue still persist in the latest plugin version:

          10:53:59  [Pipeline] withMaven
          10:53:59  [withMaven] Options: [JunitTestsPublisher[disabled=true,healthScaleFactor=,keepLongStdio=false,ignoreAttachments=false]]
          10:53:59  [withMaven] Available options: 
          10:53:59  [withMaven] IMPORTANT "withMaven(){...}" step running within a Docker container. See 
          10:53:59  Pipeline Maven Plugin FAQ in case of problem.
          10:53:59  [withMaven] using JDK installation provided by the build agent
          10:53:59  $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 printenv MAVEN_HOME
          10:53:59  $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 printenv M2_HOME
          10:53:59  $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 /bin/sh -c "which mvn"
          10:53:59  [withMaven] using Maven installation provided by the build agent with executable /usr/bin/mvn
          10:53:59  [withMaven] failed to read Maven version (127): sh: line 1: /usr/bin/mvn: No such file or directory
          10:53:59  
          10:53:59  [withMaven] found Maven version: none
          10:53:59  [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
          10:53:59  [Pipeline] {
          10:53:59  [Pipeline] sh
          10:54:00  + /srv/****/workspace/test-git2_main@tmp/withMavene5b535cf/mvn -Dmaven.test.skip=true clean package
          10:54:00  ----- withMaven Wrapper script -----
          10:54:00  Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/srv/****/workspace/test-git2_main@tmp/withMavene5b535cf/pipeline-maven-spy.jar" -Dorg.****ci.plugins.pipeline.maven.reportsFolder="/srv/****/workspace/test-git2_main@tmp/withMavene5b535cf" 
          10:54:00  Apache Maven 3.8.7
          10:54:00  Maven home: /usr/share/maven
          10:54:00  Java version: 11.0.21, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-11-jdk-amd64
          10:54:00  Default locale: en_US, platform encoding: ANSI_X3.4-1968
          10:54:00  OS name: "linux", version: "5.14.0-362.18.1.el9_3.x86_64", arch: "amd64", family: "unix"
          10:54:03  [INFO] [****-event-spy] Generate /srv/****/workspace/test-git2_main@tmp/withMavene5b535cf/maven-spy-20240129-085402-6747309581396507333011.log.tmp ...
          10:54:03  [INFO] Scanning for projects... 

          This is a simple pipeline running on maven:3.8 docker image as a build agent. Jenkins itself is running on a VM, not Docker.

          pipeline {
            agent {
              docker {
                image 'maven:3.8-eclipse-temurin-11'
              }
            }
            stages {
              stage('Build distribution package') {
                steps {
                  withMaven() {
                    sh "$MVN_CMD -Dmaven.test.skip=true clean package"
                  }
                }
              }
            }
          } 

          Vilius added a comment - - edited The issue still persist in the latest plugin version: 10:53:59 [Pipeline] withMaven 10:53:59 [withMaven] Options: [JunitTestsPublisher[disabled= true ,healthScaleFactor=,keepLongStdio= false ,ignoreAttachments= false ]] 10:53:59 [withMaven] Available options: 10:53:59 [withMaven] IMPORTANT "withMaven(){...}" step running within a Docker container. See 10:53:59 Pipeline Maven Plugin FAQ in case of problem. 10:53:59 [withMaven] using JDK installation provided by the build agent 10:53:59 $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 printenv MAVEN_HOME 10:53:59 $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 printenv M2_HOME 10:53:59 $ docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 /bin/sh -c "which mvn" 10:53:59 [withMaven] using Maven installation provided by the build agent with executable /usr/bin/mvn 10:53:59 [withMaven] failed to read Maven version (127): sh: line 1: /usr/bin/mvn: No such file or directory 10:53:59 10:53:59 [withMaven] found Maven version: none 10:53:59 [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x 10:53:59 [Pipeline] { 10:53:59 [Pipeline] sh 10:54:00 + /srv /****/ workspace/test-git2_main@tmp/withMavene5b535cf/mvn -Dmaven.test.skip= true clean package 10:54:00 ----- withMaven Wrapper script ----- 10:54:00 Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext. class. path= "/srv /****/ workspace/test-git2_main@tmp/withMavene5b535cf/pipeline-maven-spy.jar" -Dorg.****ci.plugins.pipeline.maven.reportsFolder= "/srv /****/ workspace/test-git2_main@tmp/withMavene5b535cf" 10:54:00 Apache Maven 3.8.7 10:54:00 Maven home: /usr/share/maven 10:54:00 Java version: 11.0.21, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-11-jdk-amd64 10:54:00 Default locale: en_US, platform encoding: ANSI_X3.4-1968 10:54:00 OS name: "linux" , version: "5.14.0-362.18.1.el9_3.x86_64" , arch: "amd64" , family: "unix" 10:54:03 [INFO] [****-event-spy] Generate /srv /****/ workspace/test-git2_main@tmp/withMavene5b535cf/maven-spy-20240129-085402-6747309581396507333011.log.tmp ... 10:54:03 [INFO] Scanning for projects... This is a simple pipeline running on maven:3.8 docker image as a build agent. Jenkins itself is running on a VM, not Docker. pipeline {   agent {     docker {       image 'maven:3.8-eclipse-temurin-11'     }   }   stages {     stage( 'Build distribution package ' ) {       steps {         withMaven() {           sh "$MVN_CMD -Dmaven.test.skip= true clean package "         }       }     }   } }

          Rainer Montag added a comment - - edited

          I can confirm - as the reporter of this issue - that the "good case" is fixed in 1376.v18876d10ce9c, i.e. when a valid Maven version is found, the deserialization will not fail anymore and the warning is not shown anymore.

          In the last comment it looks like if Maven is not found at all and matched to "none" it still tries to deserialize the version from "none" and throws the warning.

          Rainer Montag added a comment - - edited I can confirm - as the reporter of this issue - that the "good case" is fixed in 1376.v18876d10ce9c, i.e. when a valid Maven version is found, the deserialization will not fail anymore and the warning is not shown anymore. In the last comment it looks like if Maven is not found at all and matched to "none" it still tries to deserialize the version from "none" and throws the warning.

          Vilius added a comment - - edited

          As you can see from the logs Maven is actually found by running 

          docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 /bin/sh -c "which mvn"

          It detects Maven at /usr/bin/mvn which is correct, but then fails to detect the version, even though later it prints the version correctly.

          I think the problem could lie in quotes around Maven path in https://github.com/jenkinsci/pipeline-maven-plugin/blob/09ed655e745abccffcf741f5b4979911866ddaaf/pipeline-maven/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L656 Though I could be wrong.

          EDIT: or it could be due to the fact that I'm running Maven inside Docker. I suppose ProcessBuilder() executes commands on the Jenkins VM, instead of the build agent.

          Vilius added a comment - - edited As you can see from the logs Maven is actually found by running  docker exec af49577ef94c545772aec36234622d826ee141187824e6be9ea7dd0bd58b7866 /bin/sh -c "which mvn" It detects Maven at /usr/bin/mvn which is correct, but then fails to detect the version, even though later it prints the version correctly. I think the problem could lie in quotes around Maven path in https://github.com/jenkinsci/pipeline-maven-plugin/blob/09ed655e745abccffcf741f5b4979911866ddaaf/pipeline-maven/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L656 Though I could be wrong. EDIT: or it could be due to the fact that I'm running Maven inside Docker. I suppose ProcessBuilder() executes commands on the Jenkins VM, instead of the build agent.

          Benoit added a comment -

          Should now be fixed with https://github.com/jenkinsci/pipeline-maven-plugin/pull/766, to be released soon

          Benoit added a comment - Should now be fixed with https://github.com/jenkinsci/pipeline-maven-plugin/pull/766 , to be released soon

          Vilius added a comment - - edited

          At least for me it is still not fixed. I get this with latest plugins:

          12:31:05  $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 printenv MAVEN_HOME
          12:31:06  $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 printenv M2_HOME
          12:31:06  $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 /bin/sh -c "which mvn"
          12:31:06  [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x
          

          The linked PR also displays the same "unknown" message in "After" section.

          Vilius added a comment - - edited At least for me it is still not fixed. I get this with latest plugins: 12:31:05 $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 printenv MAVEN_HOME 12:31:06 $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 printenv M2_HOME 12:31:06 $ docker exec 22b1fdf0fb4a1630a576a4794c3e2751156e2a4c347e3df224464bd43a48d076 /bin/sh -c "which mvn" 12:31:06 [withMaven] WARNING: You are running an old version of Maven (UNKNOWN), you should update to at least 3.8.x The linked PR also displays the same "unknown" message in "After" section.

          Rainer Montag added a comment -

          The change from https://github.com/jenkinsci/pipeline-maven-plugin/pull/766 has introduced a new severe problem, because withMaven does not install JDK and maven anymore when called inside the container() block of the kubernetes plugin. (see comments on pull request).
          We are still running 1376.v18876d10ce9c - the version before the PR.

          Rainer Montag added a comment - The change from https://github.com/jenkinsci/pipeline-maven-plugin/pull/766 has introduced a new severe problem, because withMaven does not install JDK and maven anymore when called inside the container() block of the kubernetes plugin. (see comments on pull request). We are still running 1376.v18876d10ce9c - the version before the PR.

            bguerin Benoit
            rmontag Rainer Montag
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: