feat: Support multi-module Java projects in tasks#244
Open
drmaniac wants to merge 1 commit intozed-extensions:mainfrom
Open
feat: Support multi-module Java projects in tasks#244drmaniac wants to merge 1 commit intozed-extensions:mainfrom
drmaniac wants to merge 1 commit intozed-extensions:mainfrom
Conversation
Collaborator
|
Thanks for the PR, could you provide steps to test these changes or add how you tested them? |
5b53433 to
0e45c2c
Compare
Previously, Zed's Java tasks for running and testing applications did not correctly support multi-module Maven or Gradle projects. When executing a task from a file within a submodule, the commands would attempt to run at the root level, potentially leading to incorrect execution or failures. This change introduces logic to dynamically determine the nearest Maven `pom.xml` or Gradle `build.gradle`/`settings.gradle` file relative to the currently active file. It then modifies the Maven and Gradle commands to target the specific module. For Maven, this involves adding the `-pl <module>` and `-am` flags. For Gradle, it prepends the module path (e.g., `:module-name:`) to the `run` or `test` command. This ensures that tasks are executed within the context of the correct module, improving the developer experience for multi-module Java projects.
0e45c2c to
bb03226
Compare
Author
|
Hi, I have added integration tests to this project (I wasn't sure if these are allowed/expected for extensions). In addition, I apologize that the original PR had an issue with the Maven part; I have fixed it. I also tested the changes in tasks.json by adding them as custom tasks in my local Zed config. I tried it out on a complex Gradle project with composite and multiple modules, and a Maven project with multiple modules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, Zed's Java tasks for running and testing applications did not correctly support multi-module Maven or Gradle projects. When executing a task from a file within a submodule, the commands would attempt to run at the root level, potentially leading to incorrect execution or failures.
This change introduces logic to dynamically determine the nearest Maven
pom.xmlor Gradlebuild.gradle/settings.gradlefile relative to the currently active file. It then modifies the Maven and Gradle commands to target the specific module.For Maven, this involves adding the
-pl <module>and-amflags. For Gradle, it prepends the module path (e.g.,:module-name:) to therunortestcommand. This ensures that tasks are executed within the context of the correct module, improving the developer experience for multi-module Java projects.