fwcd / fwcd/kotlin-debug-adapter

How to make this work?

Open
#7 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
150
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I'm unable to make this work.
The instruction on this GitHub page are not very helpful.

I configured the following tasks (`tasks.json`):

```
{
"version": "2.0.0",
"tasks": [
{
"label": "backend: start",
"type": "shell",
"command": "./gradlew bootRun",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "backend: build",
"type": "shell",
"command": "./gradlew clean build",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
```

Both work great.

I also configured a launch configuration (`launch.json`):

```
{
"version": "0.2.0",
"configurations": [
{
"type": "kotlin",
"request": "launch",
"name": "Kotlin Launch",
"projectRoot": "${workspaceFolder}",
"mainClass": "ApiApplicationKt",
"preLaunchTask": "backend: build"
}
]
}
```

In my build.gradle I configured the following options:

```
buildscript {
ext {
kotlin_version = "1.3.0"
...
}

repositories {
mavenCentral()
google()
jcenter()
gradlePluginPortal()
}

dependencies {
....
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}")
}
}

apply plugin: "kotlin"
apply plugin: "kotlin-spring"
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"
apply plugin: 'application'

group = "io.realworld"
version = "0.0.1-SNAPSHOT"
description = """api"""
mainClassName = "ApiApplicationKt"
sourceCompatibility = 1.8
targetCompatibility = 1.8

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}

repositories {
mavenCentral()
google()
jcenter()
gradlePluginPortal()
}

dependencies {
compile group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: "${kotlin_version}"
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: "${kotlin_version}"
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: "${kotlin_version}"
....
}
```

When I try to launch the launch configuration I only get a

> java.lang.ClassNotFoundException: ApiApplicationKt

Is my configure okay? What else could I have done wrong to get debugging working with kotling and vs code?

Ps. I wish there would be a simple example for `tasks.json`, `launch.json`, ... in the README of this project.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.