microsoft/vscode-java-test

When project is imported by Buildship, give a clear message what to do to use test delegation

andyswe opened this issue · 7 comments

Type: Bug

Used Extension Bisect. Unsure if this is the problematic extension. Symptom. When delegating test to Gradle, the tests do not run:

Aug 23, 2024 10:27:11 AM com.microsoft.java.debug.core.UsageDataSession submitUsageData
INFO: session usage data summary
[Error - 10:27:27 AM] 23 Aug 2024, 10:27:27 Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
Project is not a Gradle build server project: demo-domain-alfa-test-framework-installDist
java.lang.IllegalArgumentException: Project is not a Gradle build server project: demo-domain-alfa-test-framework-installDist
at com.microsoft.gradle.bs.importer.handler.GradleDelegateCommandHandler.executeCommand(GradleDelegateCommandHandler.java:40)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:606)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

2024-08-23 10:27:27.320 [error] Error: Project is not a Gradle build server project: demo-domain-alfa-test-framework-installDist
at c:\Users\andy.vscode\extensions\redhat.java-1.33.0-win32-x64\dist\extension.js:2:1107545
at ie (c:\Users\andy.vscode\extensions\redhat.java-1.33.0-win32-x64\dist\extension.js:2:1107839)
at c:\Users\andy.vscode\extensions\redhat.java-1.33.0-win32-x64\dist\extension.js:2:1102623
at Immediate. (c:\Users\andy.vscode\extensions\redhat.java-1.33.0-win32-x64\dist\extension.js:2:1102643)
at process.processImmediate (node:internal/timers:478:21) java.execute.workspaceCommand {"value":"redhat.java","_lower":"redhat.java"}

Extension version: 0.42.0
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1255U (12 x 2611)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.64GB (0.80GB free)
Process Argv --crash-reporter-id d29b56a9-39d1-4f88-98e9-302942a8701e
Screen Reader no
VM 33%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
jg8ic977:31013176
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl1:31104043
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-c:31111717
ei213698:31121563

HI @andyswe, the error log says:

Project is not a Gradle build server project: demo-domain-alfa-test-framework-installDist

which I guess it's imported by Buildship, not Gradle Build Server.

Is it possible to share the project?

Thanks for following up.
I have no idea if it is imported by Buildship or Gradle Build Server, I use Open Folder in VSC. The project runs fine with in IntelliJ and from command line.

Here is the project: https://github.com/axiomatics/policy-testing-framework

It requires credentials to a private Maven in order to pull dependencies and run fully, however i think it can be troubleshooted without these credentials.

The Testing activity gives "The test run did not record any output" and then the "Project is not Gradle build server project" in the logs. Expected output, without the correct credentials, would be an error "Credential to Axiomatics repository not set. Please set credentials provided by Axiomatics in file gradle.properties or as environment variables. If you have not received the credentials, contact your Axiomatics support"

Have you opened this project before?

The project has been opened before.

Now if I tried with a new repo clone, ensured no IntelliJ, VSC or Gradle deamon is runnig, the tests works (run tests via delegation to Gradle)

If I open a clone that has been previously run in IntelliJ/VSC/cmd line, it fails again.

Log files 2-Build Server for Gradle (Build).log and 3-Build Server for Gradle (Log).log are empty.

File 1-Gradle for Java.log contains exceptions about closed pipes. Might be symptoms rather than cause.

Previously I have got exceptions about locked files and some file/directory not found, but unable to reproduce these now.
Is there any more logging I can turn on for gradle daemon/build server?

I think for the clone that you previously opened in vscode, you can try run the command Java: Clean Java Language Server Workspace > Reload and Delete to force a re-import

Yes, your suggestion works for the previously opened project. Let me know if I can provide any more logs or info in order to troubleshoot and fix this from happening.

Or if you have any more info as to why this is happening.
Otherwise close the issue. And thanks for your help!

Thank you for the information.

So basically we have two different type of importer for Gradle project, buildship and gradle build server. Only the latter one support the test delegation.

If the project is imported by buildship, test delegation cannot be run. So do a re-import and let it be imported by gradle build server makes the trick.

I think one follow-up thing I can do is to telling user that the project needs to be reimported to use that feature.

Thank you for reporting this issue to us.