gpt4 book ai didi

debugging - 如何在IDE Intellij中调试Kolin Vertx Web应用程序?

转载 作者:行者123 更新时间:2023-12-02 13:13:05 25 4
gpt4 key购买 nike

我创建了一个与Gradle一起运行的Kotlin Vertx Web应用程序。但是,当我尝试通过运行Intellij调试配置对其进行调试时,不会遇到断点。如何使这些断点起作用?

buildscript {
ext {
kotlinVersion = '1.2.60'
}

repositories {
mavenCentral()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.3.11'
id 'jacoco'
id 'de.jansauer.printcoverage' version '2.0.0'}

jacoco{
toolVersion = '0.8.2'
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.1
}
}
}
}


jacocoTestReport {
reports {
csv.enabled true
xml.enabled true
html {
enabled true
destination file("$buildDir/reports/jacoco")
}
}
executionData(test)
}

tasks.build.dependsOn(jacocoTestReport)

printcoverage {
coverageType = 'INSTRUCTION'
}

apply plugin: 'kotlin'

ext {
kotlinVersion = '1.2.60'
vertxVersion = '3.6.2'
junitJupiterEngineVersion = '5.2.0'
}

repositories {
mavenLocal()
jcenter()
}

group 'com.joyfulyell'
version '1.0-SNAPSHOT'

sourceCompatibility = '1.8'
mainClassName = 'io.vertx.core.Launcher'

def mainVerticleName = 'io.vertx.starter.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = './gradlew classes'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-lang-kotlin:$vertxVersion"
compile "io.vertx:vertx-mongo-client:$vertxVersion"
implementation 'org.kodein.di:kodein-di-generic-jvm:6.0.1'
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+"
compile 'com.beust:klaxon:5.0.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'

testImplementation "io.vertx:vertx-junit5:$vertxVersion"
testRuntime("org.junit.jupiter:junit-jupiter-engine:$junitJupiterEngineVersion")
}

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

shadowJar {
classifier = 'fat'
manifest {
attributes 'Main-Verticle': mainVerticleName
}
mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
}
}

test {
useJUnitPlatform()
testLogging {
events 'PASSED', 'FAILED', 'SKIPPED'
}
reports {
junitXml.enabled = true
html.enabled = true
}
jacoco{
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}

run {
args = ['run', mainVerticleName,
"--redeploy=$watchForChange",
"--launcher-class=$mainClassName",
"--on-redeploy=$doOnChange"
]
}

task wrapper(type: Wrapper) {
gradleVersion = '5.0'
}


enter image description here

最佳答案

通过配置Gradle,您应该能够很好地运行调试:

enter image description here

并点击调试按钮。使用您的配置对其进行了测试。

只要确保您在build.gradle中指定正确的顶点名称即可:
def mainVerticleName = 'io.vertx.starter.MainVerticle'

关于debugging - 如何在IDE Intellij中调试Kolin Vertx Web应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54336700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com