79258514

Date: 2024-12-06 15:24:43
Score: 2
Natty:
Report link

Depending on the image used by the build, JDK21 may already be installed. See e.g. the Java versions available in the Ubuntu-20.04 image.

So the only thing required is to use e.g JavaToolInstaller to specify the version you want to use:

  - task: JavaToolInstaller@0
    inputs:
      versionSpec: '21'
      jdkArchitectureOption: 'x64'
      jdkSourceOption: 'PreInstalled'

and then specify this version in the Gradle task:

  - task: Gradle@3
    inputs:
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.21'
      jdkArchitectureOption: 'x64'
      tasks: 'clean test'

See also: Is it possible to use JDK 21 in an Azure Pipeline Gradle task?

Reasons:
  • Blacklisted phrase (1): Is it possible to
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
Posted by: Erik Finnman