Skip to content

Run GitHub actions integration tests with Java 16 - #456

Merged
mthmulders merged 4 commits into
apache:masterfrom
infosupport:run-github-actions-it-on-java16
Apr 4, 2021
Merged

mthmulders merged 4 commits into
apache:masterfrom
infosupport:run-github-actions-it-on-java16

Conversation

@mthmulders

Copy link
Copy Markdown
Contributor

No description provided.

@slachiewicz slachiewicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove java 15 and replace it with 16. Optionally we may add 17-ea

@mthmulders

Copy link
Copy Markdown
Contributor Author

The MavenITmng7045DropUselessAndOutdatedCdiApiTest test appears to use Groovy. That test fails with

Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at groovyjarjarasm.asm.ClassReader.<init> (ClassReader.java:189)
    at groovyjarjarasm.asm.ClassReader.<init> (ClassReader.java:170)
    at groovyjarjarasm.asm.ClassReader.<init> (ClassReader.java:156)
    at groovyjarjarasm.asm.ClassReader.<init> (ClassReader.java:277)

@michael-o

Copy link
Copy Markdown
Member

Groovy and/or ASM nees to be updated. @rmannibucau , can you help?

@mthmulders

Copy link
Copy Markdown
Contributor Author

The offending test has a Groovy script in the POM. It uses the gmavenplus-plugin with an inline dependency on Groovy 3.0.7, which is the latest version of Groovy.

According to the Groovy build, that version of Groovy uses ASM 9.0.

But the ASM changelog says Java 17 support was only added with ASM 9.1. That version is only included in Groovy 4.0.0-alpha-2. Do we want to move to 4.0.0-alpha-2 for that?

@rmannibucau

Copy link
Copy Markdown
Contributor

@mthmulders I'd move MavenITmng7045DropUselessAndOutdatedCdiApiTest to pure java or bsh I think to avoid this issue each 6 months maybe

@mthmulders

Copy link
Copy Markdown
Contributor Author

@mthmulders I'd move MavenITmng7045DropUselessAndOutdatedCdiApiTest to pure java or bsh I think to avoid this issue each 6 months maybe

I could give that a try, but before I do that, let me make sure I understand the test. It verifies if the javax.enterprise.inject.Instance class has a method stream. It should have that method; if it does not, the test should fail.

This could also be implemented with a Java source file that we try to compile - if compilation fails, the test should also fail. Did I understand it correctly?

@rmannibucau

Copy link
Copy Markdown
Contributor

@mthmulders that's what the test does yes. The most important is the execution classloader which should rely on the plugin loader, can be done with a .java but must be executed in a mojo classloader (so exec-maven-plugin does a bit too much to test that accurately so not sure about a .java).

@mthmulders

Copy link
Copy Markdown
Contributor Author

I've tried to rewrite the Groovy script to a JUnit test. The test succeeds with both Maven 3.6.3 and 4.0.0-alpha-1-SNAPSHOT:

[INFO] Running org.apache.maven.its.mng7045.FindMethodFromDependencyTest
InstanceSource: (file:/Users/maarten/.m2/repository/javax/enterprise/cdi-api/2.0/cdi-api-2.0.jar <no signer certificates>)

Note that I switched the Geronimo dependency for the javax.enterprise one, as the Geronimo one gives

java.lang.NoClassDefFoundError: javax/inject/Provider
    at org.apache.maven.its.mng7045.FindMethodFromDependencyTest.findInstanceStreamMethod(FindMethodFromDependencyTest.java:9)

The test runs using Surefire 3.0.0-M5 and JUnit 4.13.2.

But that route doesn't help us, as we can't determine whether CDI 1.0 "leaked in" or not. To be continued - but given that I know nothing about bsh or how to run it from Maven, it will probably take a lot longer. If anyone else does, feel free to chime in.

@mthmulders

mthmulders commented Mar 24, 2021 •

Copy link
Copy Markdown
Contributor Author

I gave BeanShell a try this evening, but I'm greeted with

Class: javax.enterprise.inject.Instance not found in namespace

So, to summarise:

@mthmulders that's what the test does yes. The most important is the execution classloader which should rely on the plugin loader, can be done with a .java but must be executed in a mojo classloader (so exec-maven-plugin does a bit too much to test that accurately so not sure about a .java).

If I understand correctly, we can't run this test using the exec-maven-plugin.

From my experience, we can't run it with JUnit and we can't run it with Bsh either. I'm afraid we're running out of options....

I think there are not much other options left than moving to Groovy 4.0.0-alpha-2 and hoping not every new Java release will see this issue.

@mthmulders
mthmulders force-pushed the run-github-actions-it-on-java16 branch from a4dbc52 to 2df9be6 Compare April 2, 2021 08:26
@mthmulders

Copy link
Copy Markdown
Contributor Author

But the ASM changelog says Java 17 support was only added with ASM 9.1. That version is only included in Groovy 4.0.0-alpha-2.

Turns out ASM 9.1 is not in Groovy 4.0.0-alpha-2 either - it is only in HEAD. According to the Groovy issue tracker, it may end up in Groovy 3.0.8 and/or 4.0.0-alpha-3. Both of them are not released at this point.

Therefore, I will create a separate merge request to add Java 17-ea to the matrix, and this merge request will only add Java 16. We can then merge this one on short notice, and merge the other one when there is a suitable Groovy version available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants