Problem
Sonatype for Azure Devops reports an ERROR message:
[ERROR] The current Java version is not compatible with IQ-CLI, please use Java 17
Diagnosis
The error is reported when the version of Sonatype for Azure Devops requires Java 17 to execute.
On August 08, 2024 version 1.7.20 was released that requires Java 17 runtime to execute. Sonatype subsequently recognized this was an impactful breaking change to some customer pipelines.
On August 12, 2024 Sonatype released version 1.7.21 which restored Java 8/11 compatibility.
On August 16, 2024 Sonatype released version 2.0.0 which now requires Java 17.
In summary..
- Version 2.x works only with Java 17 and supports IQ 180
- The only 1.x version that requires Java 17 is 1.7.20
- All other 1.x versions support Java 8 and/or Java 11 and IQ Server < 180.
Solutions
Customers should choose the specific version of the extension for their environment. There are special considerations for deployments when using Classic Pipelines and YAML Pipelines.
Classic Pipelines
Classic Pipelines only allow a user to choose a major extension version for their pipeline, either 1.* or 2.*
YAML Pipelines
Yaml based Pipelines can be pinned to a specific version, but require the pipeline to be edited.
When I do not have version 1.7.21
There could be situations where the last version of Nexus plugin to be run in a pipeline was 1.7.20 and then the next time it was run, version 2.0.0 was already out, which caused version 1.7.21 to be missing.
In Azure, you can only "pin" a version that was actually run (or installed) within your organization instance. So for those cases, 1.7.21 will not be available.
For yaml pipelines, 1.7.19 can be used instead. But for classic pipelines, which got version 1.* "stuck" on 1.7.20 as it's latest, your options will be edit the pipeline and add a new task right before the Nexus one, to run the Java Tool Installer and set Java 17 to run the Nexus plugin.
Where Classic Pipelines are used and the latest 1.* version is 1.7.20, users can create a "task group", which can include steps to use the java tool to setup Java 17, then use Nexus plugin. And in this scenario where Java 17 has to be installed, they can simply go with the latest version 2.*
Set Java 17 as the Java to use before NexusIQPipelineTask
Edit the raw yaml of your pipeline.
Find the NexusIqPipelineTask
execution.
Set the java version to java 17 just immeditely before our task
- task: JavaToolInstaller@0
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
Immediately following the NexusIqPipelineTask
you can reset the Java version back to your preferred Java version for the subsequent tasks in your pipeline, using the same method as above.
Pin the version of our extension to an extension version supporting Java 8
Edit the yaml, find the NexusIqPipelineTask
and specify the version supporting Java 8 and Java 11:
Example:
- task: NexusIqPipelineTask@1.7.19
inputs:
nexusIqService: 'IQ Instance'
applicationId: 'testdata'
stage: 'Build'
scanTargets: '**/*.jar, !**/.git/**'