我使用带有Gradle的Spring Boot。
升级到以下内容:
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RC1")
。 。 。从1.2.7.RELEASE引起以下问题:
* What went wrong:
A problem occurred evaluating root project 'vampr'.
> Could not find property 'run' on org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated@12e13f2b.
如何解决这个问题?
构建文件:
buildscript {
ext.kotlin_version = '1.0.0-beta-1038'
repositories {
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "https://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'kotlin'
apply plugin: 'spring-boot'
apply plugin: "jacoco"
jar {
baseName = 'vampr'
version = '0.1.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "https://repo.spring.io/libs-release" }
}
// New entire sourceSets
sourceSets {
main {
kotlin {
srcDir "src/main/kotlin"
}
}
test {
kotlin {
srcDir "test/main/kotlin"
}
}
integrationTest {
kotlin {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/kotlin')
}
resources.srcDir file('src/integration-test/resources')
}
main.java.srcDirs += 'src/main/kotlin'
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
compile("org.springframework.boot:spring-boot-starter-data-rest")
// compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.social:spring-social-facebook:2.0.2.RELEASE")
testCompile("junit:junit")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
}
test {
jacoco {
append = true
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpFile = file("$buildDir/jacoco/classpathdumps")
}
}
jacoco {
applyTo run
}
task applicationCodeCoverageReport(type:JacocoReport){
executionData run
sourceSets sourceSets.main
}
答案 0 :(得分:1)
看起来ver 1.3.0+用“bootRun”替换了“run”属性。
尝试更新
jacoco {
applyTo run
}
到
jacoco {
applyTo bootRun
}