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

Tool can not find maven - log message missleading

    XMLWordPrintable

Details

    • pipeline-maven-3.11.0

    Description

      in a clean jenkins (no maven plugin installed)

      In an agent without maven on the path add MAVEN_HOME to the environment variables for the node.

       

      run the follwoing pipeline

      node {
          bat "set"
          withMaven {
              git changelog: false, poll: false, url: 'https://github.com/jtnord/maven-test-project.git'
              
              bat "mvn package"
          }
      }
      

      This should work as MAVEN_HOME is in the environment as confimerd by the set command.

      However it fails with the following message

      [withMaven] use JDK installation provided by the build agent
      $ where mvn.cmd
      $ where mvn.bat
      [withMaven] use Maven installation provided by the build agent with executable null
      [Pipeline] // withMaven
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Could not find maven executable, please set up a Maven Installation or configure MAVEN_HOME or M2_HOME environment variable

      But MAVEN_HOME is defined - so this is just plain wrong...

       

      Attachments

        Issue Links

          Activity

            Yes @bguerin. We can do it next week if you want. Just send me an email to aheritier AT Apache DOT org

            aheritier Arnaud Héritier added a comment - Yes @bguerin. We can do it next week if you want. Just send me an email to aheritier AT Apache DOT org
            bguerin Benoit added a comment -

            Hello here,

            Sorry for being silent so long, I had no spare time last months ...

            > In my point of view it would make sense to switch to the automatic CI/CD pipeline of Jenkins

            Totaly agree, it is on my todo list, I just would like to increase the test coverage first

            aheritier do you have some time in the coming days to teach me how to release ?

            bguerin Benoit added a comment - Hello here, Sorry for being silent so long, I had no spare time last months ... > In my point of view it would make sense to switch to the automatic CI/CD pipeline of Jenkins Totaly agree, it is on my todo list, I just would like to increase the test coverage first aheritier do you have some time in the coming days to teach me how to release ?

            aheritier, bguerin, is there any update on building the release? In my point of view it would make sense to switch to the automatic CI/CD pipeline of Jenkins to prevent having to relay on the maintainers to get a release. Building a release temporarily is acceptable as a short term solution, but at some point an official release should follow...

            repolevedavaj Jonas Bamberger added a comment - aheritier , bguerin , is there any update on building the release? In my point of view it would make sense to switch to the automatic CI/CD pipeline of Jenkins to prevent having to relay on the maintainers to get a release. Building a release temporarily is acceptable as a short term solution, but at some point an official release should follow...

            teilo I would prefer to let the ne‹ maintainer bguerin doing it if possible

            But I agree we should release it ASAP

            aheritier Arnaud Héritier added a comment - teilo I would prefer to let the ne‹ maintainer bguerin doing it if possible But I agree we should release it ASAP
            davidnewcomb David Newcomb added a comment -

            Many thanks. I think the problem was that we didn't need a tools section before and now we do and it caught us off guard.

            Once I'd got the Maven installations set up in Jenkins so that it was downloading the correct version of Maven (as part of the pipeline) I found that JAVA_HOME was not being set. Maybe this would have been set if I added a JDK to the Jenkins configuration but we use Java11 and it is not possible to add a platform folder as the java home. (You have to install from zip or from Oracle+license etc). For that I had to add a global environment variable for JAVA_HOME which seemed a bit disconnected but this is probably going slightly off-topic as it's not strictly part of withMaven; however withMaven gets a bit confused if JAVA_HOME is not set properly.

            Thanks for the tip about building it myself, I will look into that.

            davidnewcomb David Newcomb added a comment - Many thanks. I think the problem was that we didn't need a tools section before and now we do and it caught us off guard. Once I'd got the Maven installations set up in Jenkins so that it was downloading the correct version of Maven (as part of the pipeline) I found that JAVA_HOME was not being set. Maybe this would have been set if I added a JDK to the Jenkins configuration but we use Java11 and it is not possible to add a platform folder as the java home. (You have to install from zip or from Oracle+license etc). For that I had to add a global environment variable for JAVA_HOME which seemed a bit disconnected but this is probably going slightly off-topic as it's not strictly part of withMaven; however withMaven gets a bit confused if JAVA_HOME is not set properly. Thanks for the tip about building it myself, I will look into that.

            People

              bguerin Benoit
              teilo James Nord
              Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: