自从将Gradle升级到版本6之后,我注意到了与我用TestKit实现的功能测试相关的新警告。我很清楚如何摆脱它们。尚不清楚的是,它们最初为何出现,以及它们在功能测试中的相关性如何。
下面是我能想到的重现这个问题的最小项目:
https://github.com/automatictester/gradle-issure-repro
相关build.gradle
plugins {
id 'java'
id 'java-gradle-plugin'
}
sourceSets {
functionalTest {
java {
srcDir file('src/functionalTest/java')
}
resources {
srcDir file('src/functionalTest/resources')
}
compileClasspath += sourceSets.main.output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
}
task functionalTest(type: Test) {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
check.dependsOn functionalTest
gradlePlugin {
testSourceSets sourceSets.functionalTest
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
dependencies {
testImplementation gradleTestKit()
testImplementation 'org.testng:testng:7.1.1'
}
// uncomment to get rid of warnings
//processFunctionalTestResources {
// duplicatesStrategy = DuplicatesStrategy.INCLUDE
//}您可以通过以下方式重现此问题:
./gradlew clean functionalTest --warning-mode all
输出:
Copying or archiving duplicate paths with the default duplicates strategy has been deprecated. This is scheduled to be removed in Gradle 7.0. Duplicate path: "build.gradle". Explicitly set the duplicates strategy to 'DuplicatesStrategy.INCLUDE' if you want to allow duplicate paths. Consult the upgrading guide for further information: https://docs.gradle.org/6.2.1/userguide/upgrading_version_5.html#implicit_duplicate_strategy_for_copy_or_archive_tasks_has_been_deprecated
Copying or archiving duplicate paths with the default duplicates strategy has been deprecated. This is scheduled to be removed in Gradle 7.0. Duplicate path: "settings.gradle". Explicitly set the duplicates strategy to 'DuplicatesStrategy.INCLUDE' if you want to allow duplicate paths. Consult the upgrading guide for further information: https://docs.gradle.org/6.2.1/userguide/upgrading_version_5.html#implicit_duplicate_strategy_for_copy_or_archive_tasks_has_been_deprecated
BUILD SUCCESSFUL in 1s
6 actionable tasks: 6 executed它基本上是为在src/functionalTest/resources中找到的每个文件打印一个警告。
有人能帮助我理解这个警告的风险是什么吗?为什么根据官方指南设置的功能测试配置会出现与复制或归档任务相关的东西?
https://stackoverflow.com/questions/60420846
复制相似问题