javavscode icon indicating copy to clipboard operation
javavscode copied to clipboard

run/debug uses gradle test when it shouldn't

Open robaho opened this issue 11 months ago • 1 comments

Often times, a standalone java program will be placed in the src/test folder to avoid having it included in a minimal production jar. The problem is that if you try to run that program using a 'launch configuration' it always uses the gradle test command - which fails.

For example:

src/test/SimpleFileServer.java

it tries to run using:

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-23.jdk/Contents/Home"
cd /Users/robertengels/httpserver; ./gradlew --configure-on-demand -x check cleanTest test --debug-jvm --tests SimpleFileServer

which fails, because SimpleFileServer is not a "test" (i.e. does not extend TestCase, etc.)

Is there any way to make this work?

Using extension 23.0.1 and VSCode 1.96.2

robaho avatar Dec 23 '24 16:12 robaho

You can see a sample project at github.com/robaho/httpserver

robaho avatar Dec 23 '24 16:12 robaho