Azure DevOps에서 pipeline의 jdk 버전 변경

2024. 7. 6. 23:54클라우드/Azure DevOps

에러

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project home: Fatal error compiling: error: release version 17 not supported

조치

# JDK 버전을 변경
- task: JavaToolInstaller@0
  inputs:
    versionSpec: '17'
    jdkArchitectureOption: 'x64'
    jdkSourceOption: 'PreInstalled'
    
 # JDK 버전 확인
 - task: Bash@3
  displayName: 'before'
  inputs:
    targetType: 'inline'
    script: |
      set -x
      ls
      java -version
      mvn -v
      echo %JAVA_HOME%
      
 # maven 적용
 - task: Maven@4
  inputs:
    mavenPomFile: 'pom.xml'
    publishJUnitResults: true
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Default'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false