Issue with gradle test in java 9- gradle test is not able to find any class files

Migrating mockito to java 9 for class project. This is the code for open source mockito framework.

There is only 1 module and its the main module. All the code is in main module.
Test is default module created by intellij when i open the project. have not added any file for it.

Facing issue with gradle test for weeks now.

Gradle build is successful when i exclude tasks javadoc and checkstyleMain. There is some issue with these tasks.
All class files are generated in build/classes folder.

When i run gradle test, all tests fail with error similar to below.
Gradle version - 4.7

Issues similar to this:
org.mockitousage.basicapi.MocksCreationTest > should_strip_annotations FAILED
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.AnnotationEngine (alternate: null)

    Caused by:
    java.lang.IllegalStateException: Internal problem occurred, please report it. Mockito is unable to load the default implementation of class that is a part of Mockito distribution. Failed to load interface org.mockito.plugins.AnnotationEngine

        Caused by:

java.lang.ClassCastException: org.mockito.configuration.DefaultMockitoConfiguration cannot be cast to org.mockito.configuration.MockitoConfiguration

Could anyone help me how to resolve the issue?