Gradle, как заставить выбрать последнюю версию зависимостей третьей части - PullRequest
0 голосов
/ 10 декабря 2018

У меня есть некоторые предупреждения относительно грязного пути к классам:

w: Runtime JAR files in the classpath have the version 1.2, which is older than the API version 1.3. Consider using the runtime of version 1.3, or pass '-api-version 1.2' explicitly to restrict the available APIs to the runtime of version 1.2. You can also pass '-language-version 1.2' instead, which will restrict not only the APIs to the specified version, but also the language features
w: C:\Users\gbarbieri\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-reflect\1.2.50\9fab8887f91c8e17cce1a7522f45dc25976e57b9\kotlin-reflect-1.2.50.jar: Runtime JAR file has version 1.2 which is older than required for API version 1.3
w: C:\Users\gbarbieri\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.2.50\6b19a2fcc29d34878b3aab33fd5fcf70458a73df\kotlin-stdlib-common-1.2.50.jar: Runtime JAR file has version 1.2 which is older than required for API version 1.3
w: C:\Users\gbarbieri\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.2.50\66d47b004c5b8a1d2d1df9e463187390ed741316\kotlin-stdlib-1.2.50.jar: Runtime JAR file has version 1.2 which is older than required for API version 1.3

Затем я пытался принудительно выбрать последнюю версию этих зависимостей третьей части, используя:

    constraints {
        testImplementation("$kotlin-stdlib:$kotlin_version")
        testImplementation("$kotlin-stdlib-jdk7:$kotlin_version")
        testImplementation("$kotlin-reflect:$kotlin_version")
    }

Это работало на некоторых других проектах, но я не могу заставить его работать здесь

Если я запустил

gradle -q dependencyInsight --dependency kotlin-stdlib --configuration testCompileClasspath

Я получаю после

И в окне Idea Gradle я все еще вижу некоторую нежелательную зависимость, такую ​​как kotlin-reflect:1.2.50

Почему?

Ps: projectэто один

1 Ответ

0 голосов
/ 10 декабря 2018

Очевидно, это работает:

project(":glm") {
    dependencies {
        constraints {
            testImplementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
            testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version")
            testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
        }
    }
}

project(":glm-test") {
    dependencies {
        constraints {
            implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
            implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version")
            implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
        }
    }
}

Но если я попытаюсь параметризовать начало строк в constraints следующим образом:

buildscript {    
    ext{
        kotlin = 'org.jetbrains.kotlin:kotlin'
    }
}

Тогда это больше не работает.. странно

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