I have an Azure Pipeline that is meant to install Java 16 and the run Maven package on my repository. The pipeline looks like this:
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '16'
jdkDestinationDirectory: '$(Agent.ToolsDirectory)/jdk16'
jdkArchitectureOption: 'x64'
jdkSourceOption: AzureStorage
azureResourceManagerEndpoint: ******
azureStorageAccountName: ******
azureContainerName: ******
azureCommonVirtualFile: jdk-16.0.1_linux-aarch64_bin.tar.gz
- task: Maven@3
inputs:
mavenPomFile: '$(Build.SourcesDirectory)/pom.xml'
options: '-P test'
publishJUnitResults: false
javaHomeOption: JDKVersion
mavenVersionOption: Default
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
Unfortunately this does not run correctly and gives me the following error on the Mavern task
Starting: Maven ============================================================================== Task : Maven Description : Build, test, and deploy with Apache Maven Version : 3.186.0 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/maven ============================================================================== Maven is not installed on the agent /usr/bin/mvn -version /usr/bin/mvn: 191: exec: /opt/hostedtoolcache/jdk16/JAVA_HOME_16_X64_jdk-16.0.1_linux-aarch64_bin_tar.gz/jdk-16.0.1/bin/java: Exec format error ##[error]Build failed. ##[error]Exit code 1 returned from process: file name '/home/vsts/agents/2.187.1/externals/node10/bin/node', arguments '"/home/vsts/work/_tasks/Maven_ac4ee482-65da-4485-a532-7b085873e532/3.186.0/maventask.js"'. Finishing: Maven
However if I remove the first task to install the Java 16 JDK the error I get suggest that Maven is installed as it downloads each of the pom files and errors much later in the process with the error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project printserver: Fatal error compiling: error: invalid target release: 16 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Which I believe is happening because it cannot access Java 16.
Can anyone point me in the right direction to be able to install the Java 16 JDK and have Maven still play nicely please?