-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix running tests in multi-project builds #100
Comments
This might be the biggest blocker for people to use this plugin in real world settings |
I created a related issue with potential solutions, which was moved to discussions. I am linking it here for reference: #149 |
Relates to #100 Key Changes: * Module & Project Support: * Introduced Module and Project classes to handle multi-module Java projects. * Each module can retrieve its own sources, test sources, and output directories. * Managed module dependencies for correct build order and classpath resolution. * Compiler Enhancements: * Compiler: * Refactored compile_sources and compile_test_sources to work per module. * Gradle & Maven Build Tool Updates: * Refactored to handle per-module build and dependency resolution. * Prepared classpaths for source and test modules, ensuring all dependencies are included. * Enhanced detection of source, test source, and generated files for each module. * JUnit Command Builder Updates: * Updated build_junit to use module-specific paths for classpath arguments and reports directories. * Makefile Changes: * Added Groovy parser support for nvim-treesitter in the install target.
Sorry for the latency, I had no much time for it. I just merged the feature 9e6e8cf. I'll close this issue but feel completely free to reopen! 🤙 |
I seem to understand that multi module projects are supported, but is it only the case for Gradle projects. With a few Maven multi module projects I tried it doesn't work. |
Hi @LorenzoBettini, do you have any examples? |
@rcasia this a minimal example https://github.com/LorenzoBettini/maven-multimodule-example |
This project is using Junit4, which currently is not supported. |
Not supported in a multi project? Because in a single project it works: it detects all the tests in a single project using junit4. |
Sorry, you are right. Junit4 is supported, but not junit4 with the format of the old junit3 which is being implemented here: https://github.com/LorenzoBettini/maven-multimodule-example/blob/master/my-app-parent/my-app-module1/src/test/java/org/my/app/module1/AppTest. The main incompatibility between neotest-java and junit3 format is that the test methods don't have the Test annotation class, so they will not be detected to be run. |
@rcasia sorry, I had forgotten I had created those example projects with an old version of the Maven archetype that generates JUnit 3 tests. I've update the example LorenzoBettini/maven-multimodule-example@508e6ac Still I don't understand how it is meant to work. If I start Neovim from the parent directory However, If I try to run it from there selecting a testclass and press
If I try to run all tests with
It only works if I start Neovim from one of the submodules' directory, e.g., Without quitting Neovim, I can use
Maybe I don't understand how it is supposed to work... |
With the latest plugin version, running tests in my multi-project gradle build fails.
The project consists of a number gradle sub-projects like
com.company.app.web.server.<component>
for about 10 components. Each of these then hassrc/test/java
.The statusline briefly shows
src/test/java is not accessible by the current user!
, thenError reading file: /tmp/neotest-java/<some kind of id>/TEST-junit-jupiter.xml
This is my Lazy config for neotest:
build/neotest-java/classpath.txt
does exist in the working directory, but is empty.Version
v.1.10.0
still works as before.The text was updated successfully, but these errors were encountered: