-
Notifications
You must be signed in to change notification settings - Fork 137
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
Micronaut 4 Gradle project test execution broken #1613
Comments
It's probably caused by some API changes between JUnit 5.9 & 5.10. I was trying to update the JDT Test to the latest version but unfortunately it will cause the legacy JUnit tests fails. See: #1608 |
Why is the IDE embedding a version of JUnit that is incompatible with the version used by the project? This seems poorly thought out as these versions will unlikely align |
I need to correct my statement before; the problem is not caused by the embedded JUnit libraries. The test runner will use the project's JUnit dependencies if they are available. Only when the required dependencies are not declared by the project, the test runner will use the embedded ones. The problem is caused due to some concept mismatch between the JDT project and the Gradle project. If I run Unfortunately, the concept of source set does not exist for a JDT project. One JDT project can only have one For the sample project, the problem happens after merging. Both From the JDT side, there are two options to solve the issue:
Maybe, from Micronaut side, a workaround is to align the JUnit version for all the sourceset. But I admit that, to entirely solve the issue, something needs to be done at JDT side. |
so if you run:
The only thing that is there is a BOM which should not be in the classpath. if you run:
All the JUnit dependencies are promoted from 5.9.3 to 5.10.0 (the correct version). So it seems to me that the classpath produced by the JDT tooling is simply incorrect and the collection algorithm for dependencies incorrect and inconsistent with the behaviour of Gradle which is a massive problem |
The problem happens due to
|
if you look at the graph the correct version The bug appears to be that VScode is erroneously including the dependencies of io.micronaut.platform:micronaut-platform:4.1.2 which is a BOM not a dependency. The classpath computation is clearly broken here. We can of course "fix" this on the Micronaut side but the bug will still be there waiting to be hit again |
A workaround is to add |
Seems this is related to #1020 which again sounds like the classpath computation for Gradle is simply incorrect |
I want to clarify that I'm not denying that current JDT cannot handle the problem perfectly. As I already said above:
All the above comment I left is the analysis that I found why the classpath is wrong in JDT, and provide a possible workaround if it's still blocking before the issue is solved from JDT side. Please don't get me wrong. |
I have the same problem with a Spring Boot gradle project in Eclipse. Using
|
Dup with #1045 (comment). There will be some update around this. |
The Gradle Test Delegation (both run and debug) has supported now. To use this feature, you need to install the latest Test Runner for Java and Gradle for Java extension. To delegate the tests to Gradle, you can set the default testing profile in Testing explorer: If you do not want to change the default testing profile, you can trigger an one-time execution via: |
Generate a sample Micronaut project using Micronaut Launch service with
Micronaut 4.1.1
,Java 17
,Gradle
, andJUnit
selected. Open generated project in VSCode with the Extension Pack for Java installed. Try to run project tests either viaTest Explorer
or by clickingRun Test
icons in source editor gutter. No test gets executed and the following error appear in the console:The text was updated successfully, but these errors were encountered: