我创建了一个与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'
}
答案 0 :(得分:1)
通过如下配置Gradle,您应该能够很好地运行调试:
然后点击“调试”按钮。使用您的配置对其进行了测试。
只需确保在// Create the object which is an array
var output = new objPropertyAndValues;
var TempArray=[]; // blank array
// Lets grab the URL (windows.location.href)
var url_string = "http://www.google.com?myName=Datacure&AnswerID=54379924&Likes=Pizza";
var url = new URL(url_string);
//We now have URL as an object to read from.
//Lets turn the searchParams into a string which we can then split into an Array
var urlParamsString = url.searchParams.toString();
//Now lets split urlParamsString into an array
var AllParamsFound = urlParamsString.split("&");
// Lets read each array item by doing a loop
// We then split the array item value by the "=" sign to split parameter and value
for (i = 0; i < AllParamsFound .length; i++){
TempArray= AllParamsFound [i].split("=");
output.Parameter[i] = TempArray[0];
output.Value[i] = TempArray[1];
}
// Example output
console.log (output.Value[0] + " should get " + output.Value[2] + " for answering question id: " + output.Value[1]);
// View the array
console.log(output);
//We allow an object to be created.
function objPropertyAndValues(){
this.Parameter = [];
this.Value = [];
}
中指定了正确的顶点名称:
build.gradle