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

[enhancement]: Support Java21 in Maven-Build task #19131

Open
aurifi opened this issue Oct 17, 2023 · 19 comments · May be fixed by #20693
Open

[enhancement]: Support Java21 in Maven-Build task #19131

aurifi opened this issue Oct 17, 2023 · 19 comments · May be fixed by #20693
Labels
Area: ABTT Akvelon Build Tasks Team area of work enhancement Task: Maven

Comments

@aurifi
Copy link

aurifi commented Oct 17, 2023

Task name

Maven

Describe your feature request here

As Java 21 is now released as LTS the Maven task should support that version. The last supported version seems to be Java 17.
Additionally it might be an idea to not have the possible versions defined as a list, as this requires updates every time a new version is released.

@DmitriiBobreshev
Copy link
Contributor

Hi @szczepad, thanks for the feedback! We'll try to add a new version in the future once we have enough time.

@DmitriiBobreshev DmitriiBobreshev added Area: ABTT Akvelon Build Tasks Team area of work Task: Maven and removed triage route labels Oct 18, 2023
@ogbesgt
Copy link

ogbesgt commented Nov 24, 2023

Hi I have this issue today, Java 21 not installed on Azure DevOps pipeline.
Got it resolved by using the installer. Thanks to Stackover flow.

- bash: 'wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz ' displayName: 'Download Java21' - task: JavaToolInstaller@0 displayName: 'Java 21 Install' inputs: versionSpec: 21 jdkArchitectureOption: x64 jdkSourceOption: LocalDirectory jdkFile: '$(build.sourcesdirectory)/jdk-21_linux-x64_bin.tar.gz' jdkDestinationDirectory: '$(agent.toolsDirectory)/jdk21'

for windows you can use this reference

@Heatmanofurioso
Copy link

Hi team,

Any idea on when might this feature get pushed?
Would be great to push for adoption of the latest LTS.

@hungchu0912
Copy link

Hello, is there any update on this feature?

@martinvisser
Copy link

Hi @szczepad, thanks for the feedback! We'll try to add a new version in the future once we have enough time.

Really appreciate it if this can be looked at

@Heatmanofurioso
Copy link

Hi team,

Any reason these issues don't get any attention?
It should be a really low effort task, especially considering how Java has been evolving, and should ensure that the community is up to date with standards and technology

@TotallyMehis
Copy link

Looking forward to this being resolved.

@svitlychnyi
Copy link

svitlychnyi commented Feb 8, 2024

Looks like it's already implemented in current version, but not yet documented.

  - task: Maven@3
    displayName: Backend Tests
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx3072m'
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.21'
      jdkArchitectureOption: 'x64'
      publishJUnitResults: true
      mavenAuthenticateFeed: true
      goals: 'clean test'

@GustavoOS
Copy link

Looks like it's already implemented in current version, but not yet documented.

  - task: Maven@3
    displayName: Backend Tests
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx3072m'
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.21'
      jdkArchitectureOption: 'x64'
      publishJUnitResults: true
      mavenAuthenticateFeed: true
      goals: 'clean test'

@DmitriiBobreshev would you confirm this for us, please?

@TotallyMehis
Copy link

Looks like it's already implemented in current version, but not yet documented.

  - task: Maven@3
    displayName: Backend Tests
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx3072m'
      javaHomeOption: 'JDKVersion'
      jdkVersionOption: '1.21'
      jdkArchitectureOption: 'x64'
      publishJUnitResults: true
      mavenAuthenticateFeed: true
      goals: 'clean test'

Tried this and it seems to work.

Only caveat being that JaCoCo's code coverage seems to be broken so we can't use this just yet.

java.lang.instrument.IllegalClassFormatException: Error while instrumenting com/example/test.
	at org.jacoco.agent.rt.internal_3570298.CoverageTransformer.transform(CoverageTransformer.java:94)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:610)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at org.apache.maven.surefire.api.util.DefaultScanResult.loadClass(DefaultScanResult.java:115)
	at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:85)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:142)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: java.io.IOException: Error while instrumenting com/example/test.
	at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrumentError(Instrumenter.java:160)
	at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:110)
	at org.jacoco.agent.rt.internal_3570298.CoverageTransformer.transform(CoverageTransformer.java:92)
	... 20 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
	at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:196)
	at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:177)
	at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:163)
	at org.jacoco.agent.rt.internal_3570298.core.internal.instr.InstrSupport.classReaderFor(InstrSupport.java:280)
	at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:76)
	at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:108)
	... 21 more

@Fradantim
Copy link

Tried this and it seems to work.

Only caveat being that JaCoCo's code coverage seems to be broken so we can't use this just yet.

#19400 bumps jacoco to 0.8.11 in task Maven@4, making it compatible with Java 21.

Also asking for this feature please.

@JWATSU
Copy link

JWATSU commented Mar 5, 2024

We also have an issue with jacoco not working with java 21 with the Maven@4 task.

@Heatmanofurioso
Copy link

@JWATSU The PR Fradantim mentioned was only merged 19 hours ago.
When did you last test it?

@Fradantim
Copy link

@Heatmanofurioso #19400 was merged on Dec 20, 2023, jwatsu has to use Maven@4 instead of Maven@3

@JWATSU
Copy link

JWATSU commented Mar 6, 2024

@Heatmanofurioso @Fradantim I use Maven@4 but the Jacoco version still isn't updated. Might it be because we are using Azure DevOps Server and it's lagging behind? How can we check this?

@Heatmanofurioso
Copy link

Heatmanofurioso commented Mar 6, 2024

@Fradantim I understood that he's using Maven@4.

@JWATSU We're using it as well, hence my questions.
I want to attempt the migration without needing custom pipelines, but seems they haven't released it there yet.

According to their release notes, it isn't there yet.
https://learn.microsoft.com/en-us/azure/devops/release-notes/features-timeline-released

@ivanduplenskikh
Copy link
Contributor

@JWATSU jacoco v0.8.11 for Java 21 is available in Maven >=4.234.0.
The previous versions of Maven task weren't updated.
Could you please check that your Maven task version is >=4.234.0?

@romchellis
Copy link

I'm also affected, there is no java21 option available :(

@ajburley
Copy link

ajburley commented Oct 1, 2024

@ivanduplenskikh I'm experiencing the same issue. In Azure DevOps, there is no option to specify the exact version, like 4.234.0. It just lets you select 4.x, 3.x, 2.x or 1.x. I have selected 4.x, but the option to select JDK 21 is still not there, and the latest one shown is JDK 17. I have to select "default" to use JDK 21, which is fine for now, but when another JDK version is released in the future it will automatically switch to use that one, which is not desired.

@ivanduplenskikh ivanduplenskikh linked a pull request Nov 26, 2024 that will close this issue
2 tasks
@ivanduplenskikh ivanduplenskikh linked a pull request Nov 26, 2024 that will close this issue
2 tasks
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

Successfully merging a pull request may close this issue.