Gradle 6, Gradle TestKit и DuplicatesStrategy.INCLUDE предупреждение - PullRequest
0 голосов
/ 26 февраля 2020

После обновления 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://docs.gradle.org/6.2.1/userguide/test_kit.html

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...