Multiple validation errors in editor when using JDK 11 with Gradle and JUnit5

Answered

Hi All,

i've an issue while trying to migrate the existing project to JDK 11.

Basically, after making required modifications to a build.gradle file. The test source codes show multiple validation errors, e.g. "Cannot resolve symbol 'Test'" (or 'Assertions').

If I add manually JUnit5.2 library with the scope Test or compile to a module dependencies as shown on the next picture everything works fine. 

The JUnit5.2 library has the same four dependencies that are listed above. Obviously, every time any change is introduced to build.gradle file dependencies list is overwritten and source code gets broken again.

When the source code is in this state I cannot run tests from IDE but gradle builds and tests are working fine all the time.

I am wondering if I am doing something fundamentally wrong or is it a bug in IDEA?

My environment looks like this:

IntelliJ IDEA 2018.2.5 (Ultimate Edition)
Build #IU-182.4892.20, built on October 16, 2018
JRE: 1.8.0_152-release-1248-b19 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.1

Regards,

Igor.

0
6 comments

Hi.

Could you please provide a project example, or a build.gradle example?

0
Avatar
Permanently deleted user

Hi,

here is the link to the test project: https://github.com/ikolomiyets/gradle-jdk-11.git

Interestingly enough, I tried to check it on Windows just to make sure that I am not loosing my mind for whatever reason, but the problem does not manifest itself in the Windows version of IDEA. But it does on Mac. The same version of IDEA.

Could it be some sort of caching issue?

0

Have you tried invalidating caches? (File | Invalidate Cache)?

0
Avatar
Permanently deleted user

I believe i did, but i'll give it another go.

 

UPD: No, it did not help.

0
Avatar
Permanently deleted user

By the way, something similar happens when working with the legacy projects, i.e. without module support (no module-info.java file in the sources).

I also noticed that in both cases the required dependencies are seen like resolved in the External Libraries node in the Project view but I expand them the jar file there cannot be be opened, it is just shown as an element in the specific library tree (see below)

I've checked and the files that are registered in the module dependencies are in place and has proper access rights, so it looks like some issue with the IDEA.

0
Avatar
Permanently deleted user

Looks like i've fixed it by manually removing the content of the ~/Library/Caches/IntelliJIdea2018.2 directory. So, I assume invalidate cache leaves something behind.

0

Please sign in to leave a comment.