Skip to content
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

[major] [bug] Gradle projects add test compile path in the launcher configuration #507

Open
gayanper opened this issue Aug 28, 2023 · 5 comments

Comments

@gayanper
Copy link
Contributor

Run the attached project, and when checking the arg file, we can see that the bin/test is added into class path which cause issues when there are different resource files for testing purpose in applications.

micrometer-demo.zip

-cp "/Users/home/micrometer-demo/bin/main:/Users/home/micrometer-demo/bin/test:...
@gayanper
Copy link
Contributor Author

Related bug originally reported in eclipse-jdtls/eclipse.jdt.ls#2819

@gayanper
Copy link
Contributor Author

I have checked how the Eclipse UI generate the run command. It seems when Exclude test code is used, it uses the output path, bin/default and when Exclude test code is not used, both bin/main and bin/test are added.

And in the extension scenario we end using all 3 paths always. When debugging it was found that bin/test comes as part of bin/test/generated-sources/annotations 's output location.

Either we can report this to buildship to add support in this scenario to provide correct paths as in Eclise or we can filter the output paths looking and the project raw classpath's output locations.

@jdneo
Copy link
Member

jdneo commented Aug 31, 2023

Hey @gayanper

We recently just released a new tool to support Gradle project - Build Server for Gradle, maybe that can help solve your problem.

If you are interested, please follow the steps below:

  • install the latest pre-release of Gradle for Java extension
    Picture1
  • (Optional) If you are using VS Code stable, set the setting "java.gradle.buildServer.enabled" to "on". Skip this if you are using Insiders
  • Run Java: Clean Java Language Server Workspace > Reload and Delete
  • After reload, if you still see
    image
    in the Java Projects explorer, it indicates that the project is still imported by Buildship, you need to clean and reload again. (This is caused by some issues that the bundle is not registered for the first time in a new workspace)
  • You should see logs
    image
    in those two output channel if the new importer is working.

@gayanper
Copy link
Contributor Author

gayanper commented Sep 3, 2023

Yes that seems to fix this issue, So I think we can close this if this build-server is the future for gradle projects, But if we are keeping the possibility to use buildship I think we might need to find away to resolve this.

@jdneo
Copy link
Member

jdneo commented Sep 4, 2023

The long-term plan is to leverage bs approach to support the Gradle project. But since currently we are still in the exploring phase for the bs approach, maybe keep this issue open until we make the decision to use BS to replace Buildship in VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants