Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-27212

Make maven use the configured JDK tool

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11.1, 2021.0
    • Component/s: Dev Tools

      Description

      Follow-up NXP-24952
      Setting the tool is not enough in some pipelines: the JAVA_HOME or the PATH is not correct.

      ftest.groovy, sonar.groovy and utest.groovy do not make Maven use the right tool:

      tests_1  | Detected JDK Version: 1.8.0-191 is not in the allowed range [11,).
      

      Setting the tool is not enough to get some related variables being set. In the case of Maven, it needs JAVA_HOME for instance.

      Here are various working solutions:

      • jdk = tool name: 'java-11-openjdk'
        env.JAVA_HOME = "${jdk}"
        
        withEnv(['MAVEN_OPTS=...']) {
            sh """#!/bin/bash -ex
                mvn -v
            """
        }
        
      • withEnv(["JAVA_HOME=${ tool 'java-11-openjdk' }", 'MAVEN_OPTS=...']) {
            sh """#!/bin/bash -ex
                mvn -v
            """
        } 
      • withMaven(jdk: 'java-11-openjdk', mavenOpts: '... <there is a bug?! prefer the following Shell export>') {
            sh """#!/bin/bash -ex
                export MAVEN_OPTS='...'
                mvn -v
            """
        }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h