allure-framework / allure-maven

Maven plugin generating Allure report from test results
Apache License 2.0
93 stars 54 forks source link

Allure maven plugin does not work on JDK 17 #290

Open fslevoaca-ionos opened 1 year ago

fslevoaca-ionos commented 1 year ago

Hi, It seems that Allure Maven plugin does not work on Java 17.

Stacktrace:

[ERROR] Failed to execute goal io.qameta.allure:allure-maven:2.12.0:report (execution) on project cucumber-tests: Execution execution of goal io.qameta.allure:allure-maven:2.12.0:report failed: An API incompatibility was encountered while executing io.qameta.allure:allure-maven:2.12.0:report: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>io.qameta.allure:allure-maven:2.12.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
ekaterinanepliueva commented 4 months ago

I've encountered the same problem. Are there any updates?

ekaterinanepliueva commented 4 months ago

I think the problem is here Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2 at java.lang.String.checkBoundsBeginEnd (String.java:4601) at java.lang.String.substring (String.java:2704) at org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat (SystemUtils.java:1133)

allure-maven dependnecy uses maven-reporting-impl:jar:3.0.0 where commons-lang:commons-lang:jar:2.4 is used instead of commons-lang3. so excluding of commons-lang doesn't help.

I see that version is upgraded in commit but this upgrade isn't included in the last version 2.12.0 https://github.com/allure-framework/allure-maven/pull/276/commits/7e0474eba03243d7d3215584cc96294d473c7e8f

jandroalvarez commented 2 months ago

I've got the same problem. Any solution so far?

ekaterinanepliueva commented 2 months ago

@jandroalvarez I've changed java version from 17 to 17.0.10, because method org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat produces StringIndexOutOfBoundsException, if gets java version not like a float number

jandroalvarez commented 2 months ago

Thank you for the answer @enepliue1 ! AFAIK java.version is a read-only property of the JVM.

How did you set the long version number to run the Maven plugin?