I'm running a gradle project with Kotlin and Java source code. I need to configure the testing environment in GitHub codespaces with VS code, I cannot use JetBrains Gateway. Even though the Gradle tasks are running successfully, the project is being built, etc. Whenever I try to run a test or work in the IDE, I receive errors.
import something.from.kotlin.KotlinCode;
import something.from.java.JavaCodeTwo;
class JavaCode {
public void method() {
KotlinCode kc = new KotlinCode(); // this line does not work
}
}
On the first line vs code shows the red error: The import something.from.kotlin.KotlinCode cannot be resolved*
Any ideas on how can I make it up and running? Right now I can only run tests using ./gradlew test I would like to be able to run and debug them using vs co
I have the following extensions installed:
Extension Pack for Java - https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack
Gradle for Java - https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle
Java Kotlin integration - https://marketplace.visualstudio.com/items?itemName=MarkNefedov.vscode-java-kotlin-mn-fork
Kotlin - https://marketplace.visualstudio.com/items?itemName=fwcd.kotlin
Kotlin Language - https://marketplace.visualstudio.com/items?itemName=mathiasfrohlich.Kotlin
None of those solved my issue.
In order to at least run some test with the debugger I've prepared a script:
#!/bin/bash
export GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"
echo 'here'
../gradlew -p .. clean test --tests '*SomeTest*'
Test runs in the debug mode on 5005, later I'm attaching a debugger using vs code and this launch.json config:
{
"type": "java",
"name": "Attach to Remote Program",
"request": "attach",
"projectName": "projectName", // the name is correct
"hostName": "localhost",
"port": "5005"
},
and even though I can stop the program from the debug panel, none of my breakpoints work:
enter image description here
any idea how could I fix the kotlin + java interoperability in the github codespace running vs code, or at least configure the debugger so I could set up the breakpoints ?