Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more recent java version in Maven@3 #14915

Closed
sfragata opened this issue May 31, 2021 · 20 comments
Closed

Use more recent java version in Maven@3 #14915

sfragata opened this issue May 31, 2021 · 20 comments
Assignees
Labels
Area: ABTT Akvelon Build Tasks Team area of work enhancement Task: Maven

Comments

@sfragata
Copy link

sfragata commented May 31, 2021

Feature
Type: Upgrade Maven task to more updated java version

Enter Task Name: Maven@3 (https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/MavenV3)

Environment

  • Server - Azure Pipelines

Issue Description

The more updated jdkVersionOption used by task Maven@3 is 11
(#jdkVersionOption: 'default' # Optional. Options: default, 1.11, 1.10, 1.9, 1.8, 1.7, 1.6)

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/maven?view=azure-devops.

I'd like to use more recent versions like java 14 or 16

@github-actions github-actions bot added Area: ABTT Akvelon Build Tasks Team area of work Task: Maven triage labels May 31, 2021
@LadyCailin
Copy link

LadyCailin commented Jun 15, 2021

I've figured out a workaround that's relatively easy enough. You just need an azure blob store where you can store the java version you want to use, then use the JavaToolInstaller to install it, then tell the maven tool to use that version. (It will give a warning, but you can ignore that.) See here for how I'm doing it. You can use the windows-2019 vm image to get the latest version of maven (3.8.1).

The underlying root problem should still be solved though, the newer versions of java aren't available by default in the JavaVersionTool, which makes this inconvenient since you have to self-host the jdk tar, but in any case, you may have to specify which java version to install in the future anyways. It would be nice if the JDK 16 was available by default, especially given that there's an official build of it available here. Perhaps this is a separate issue for the JavaToolInstaller. I'll file it.

@sfragata
Copy link
Author

My workaround was not use Maven@3 :)
I used a container maven with java 16

variables:
  maven_ops: '-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS'

trigger:
  - master

pool:
  vmImage: ubuntu-latest

container: maven:3.8.1-openjdk-16-slim

steps:
  - script: mvn ${maven_ops} -B clean verify

@sfragata
Copy link
Author

sfragata commented Jun 25, 2021

I found it LadyCailin, I think it is easier than your workaround ;)

trigger:
  - master

pool:
  vmImage: ubuntu-latest

container: maven:3.8.1-openjdk-16-slim

steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx1024m'
      javaHomeOption: 'path'
      jdkDirectory: '/usr/local/openjdk-16'
      publishJUnitResults: false
      mavenAuthenticateFeed: true
      effectivePomSkip: true

I'm using maven:3.8.1-openjdk-16-slim container so it needs to set a java home

      javaHomeOption: 'path'
      jdkDirectory: '/usr/local/openjdk-16'

@anatolybolshakov
Copy link
Contributor

Hi @sfragata thanks for reporting! We created PR with a fix for this #15021

@alexander-smolyakov
Copy link
Contributor

@sfragata, a related PR was merged. This fix will be available in the next sprint.

I will let you know once these changes are deployed.

@alexander-smolyakov alexander-smolyakov added the awaiting deployment Related changes are waiting for deployment to be completed label Jul 14, 2021
@sfragata
Copy link
Author

thanks @alexander-smolyakov

@alexander-smolyakov alexander-smolyakov removed the awaiting deployment Related changes are waiting for deployment to be completed label Aug 26, 2021
@alexander-smolyakov
Copy link
Contributor

Hi @sfragata, just an update regarding this issue:

We have decided the revert related changes to the Maven task to avoid confusion in Java versions - since only LTS tools versions are available on all images, and versions like 14 are not available widely on hosted images. We will investigate other ways of how we can resolve this issue in a better way.

@sfragata
Copy link
Author

Hi @alexander-smolyakov , that's ok, I'm using maven+java16 container for instance and it works

trigger:
  - master

pool:
  vmImage: ubuntu-latest

container: maven:3.8.1-openjdk-16-slim

steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx1024m'
      javaHomeOption: 'path'
      jdkDirectory: '/usr/local/openjdk-16'
      publishJUnitResults: false
      mavenAuthenticateFeed: true
      effectivePomSkip: true

thanks

@Heatmanofurioso
Copy link

Any news regarding this issue?
The change hasn't been deployed, and meanwhile, the new LTS "Java 17" has been out for a while now too

@il-bert
Copy link

il-bert commented Jan 12, 2022

Hi any update on this? 17 is an LTS and would be very helpful if at least that one will be included

@sfragata
Copy link
Author

Hi any update on this? 17 is an LTS and would be very helpful if at least that one will be included

Meanwhile you can use container

trigger:
  - master

pool:
  vmImage: ubuntu-latest

container: maven:3.8.1-openjdk-17

steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx1024m'
      javaHomeOption: 'path'
      jdkDirectory: '/usr/java/openjdk-17'
      publishJUnitResults: false
      mavenAuthenticateFeed: true
      effectivePomSkip: true

@alexander-smolyakov
Copy link
Contributor

Hi all, let me provide an update regarding this ticket:

At the moment the Java 17 is still not available on the following virtual images:

  • Ubuntu 18
  • Ubuntu 20

However, these images will be updated soon, here is a link to a related ticket:

Once all virtual images will contain Java 17, we will update the Maven task.

@Fred-Richer
Copy link

Fred-Richer commented Jan 17, 2022

Hi all, let me provide an update regarding this ticket:

At the moment the Java 17 is still not available on the following virtual images:

  • Ubuntu 18
  • Ubuntu 20

However, these images will be updated soon, here is a link to a related ticket:

Once all virtual images will contain Java 17, we will update the Maven task.

Hi, just wondering, does it mean that it's available on windows images?

I'm still seeing this warning when trying to use Java 17:
Value is not accepted. Valid values: "default", "1.11", "1.10", "1.9", "1.8", "1.7", "1.6".

stages:
- stage: 'Deploy'
  pool:
    vmImage: 'windows-latest'
  jobs:
  - job: 'job1'
    steps:
    - task: MavenAuthenticate@0
      inputs:
        mavenServiceConnections: MvnNexusDependencies, MvnNexusReleases 
    - task: Maven@3
      inputs:
        mavenPomFile: 'pom.xml'
        mavenOptions: '-Xmx3072m'
        javaHomeOption: 'JDKVersion'
        jdkVersionOption: '1.17'
        jdkArchitectureOption: 'x64'
        publishJUnitResults: true
        testResultsFiles: '**/surefire-reports/TEST-*.xml'
        goals: 'package deploy'
        failIfCoverageEmpty: true

@nibexo
Copy link

nibexo commented Jan 27, 2022

@alexander-smolyakov Any update?

@alexander-smolyakov alexander-smolyakov linked a pull request Jan 29, 2022 that will close this issue
2 tasks
@alexander-smolyakov
Copy link
Contributor

@alexander-smolyakov Any update?

@nibexo I have opened a pull request to update the Maven pipeline task (V2/V3). I will update the ticket once the related changes will be merged to master.

Link to related PR:

@alexander-smolyakov
Copy link
Contributor

Quick update: A related pull request was completed. The related changes for the Maven pipeline task will be available in the 200th sprint release of Azure DevOps. I will update the ticket once these changes will be deployed and available to all Azure DevOps users.

@alexander-smolyakov alexander-smolyakov added the awaiting deployment Related changes are waiting for deployment to be completed label Jan 31, 2022
@ssrm
Copy link

ssrm commented Feb 16, 2022

any expected date of available?

@Brutus5000
Copy link

He never mentioned what sprint they're currently at 🤨

@KliemannNoah
Copy link

Sprint 200 Patch Notes were released on Monday, and I can now see JDK 17 in the dropdown: https://docs.microsoft.com/en-us/azure/devops/release-notes/2022/sprint-200-update
JDK17
@ssrm @Brutus5000 @nibexo

@anatolybolshakov anatolybolshakov removed the awaiting deployment Related changes are waiting for deployment to be completed label Mar 10, 2022
@anatolybolshakov
Copy link
Contributor

Hi everyone! Closing this one since it has been fully rolled out - feel free to ask any other questions.
Sorry for missing questions here - you can also roll out status by 'awaiting deployment' label (we remove it once changes are fully rolled out to all customers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work enhancement Task: Maven
Projects
None yet
Development

No branches or pull requests