- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近更新到 gradle 版本 5.0-rc-4,当运行 ./gradlew assemble
(或任何其他任务)时,我现在收到以下消息:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
当我使用./gradlew assemble --warning-mode all
时,我得到:
> Configure project :
The DefaultSourceDirectorySet constructor has been deprecated. This is scheduled to be removed in Gradle 6.0. Please use the ObjectFactory service to create instances of SourceDirectorySet instead.
但是在下面的build.gradle
中,我没有看到我在哪里使用任何DefaultSourceDirectorySet
,所以这个警告是什么,我需要做什么更改为与 Gradle 6.0 兼容?
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.10'
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
相关
我找到了create version.txt file in project dir via build.gradle task(gradle 5.0)但我没有这样的构造,所以我不知道它如何应用。
我发现发行说明中提到了此弃用 https://docs.gradle.org/5.0-milestone-1/release-notes.html但他们说
In this release of Gradle, the ObjectFactory service, which is part of the public API, now includes a method to create SourceDirectorySet instances. Plugins can now use this method instead of the internal types.
但我不知道如何。
我还在 https://docs.gradle.org/current/javadoc/org/gradle/api/file/SourceDirectorySet.html 找到了 SourceDirectorySet
接口(interface)但我不知道如何使用它。
最佳答案
更新 2019-01-23 五分钟前,kotlin 1.3.20 为 released并在 Gradle repository 中进行了更新所以这个问题应该通过将 Kotlin Gradle 插件更新到 1.3.20 来解决。
更新2019-01-11目标版本在Youtrack issue KT-26808刚刚更新到1.3.20。您可以在 Gradle 存储库中查看最新发布的版本 here ,但是目前还有很多open issues for 1.3.20 .
更新 2018-12-17 弃用警告已在提交 https://github.com/JetBrains/kotlin/commit/67e82a54e5ee529116e881953f93a4c8f216e33a 中修复,Youtrack 问题已关闭。现在等待release推出。
作为@Javaru pointed out ,这已在 Youtrack issue KT-26808 上报告过(2018 年 9 月) .
使用来自Lance's comment的信息在链接中Thomas David Baker pointed to :
如果您在不直接使用 DefaultSourceDirectorySet
时收到此警告,则这可能来自您使用的 Gradle 插件。您可以使用 Gradle 构建的 --warning-mode all --stacktrace
标志来检查这一点,就像 ./gradlew assemble --warning-mode all --stacktrace
.
在这个特殊情况下,它是 Kotlin Gradle 插件,他们在 DefaultKotlinSourceSet.kt#L140-L155 使用它。 :
private val createDefaultSourceDirectorySet: (name: String?, resolver: FileResolver?) -> SourceDirectorySet = run {
val klass = DefaultSourceDirectorySet::class.java
val defaultConstructor = klass.constructorOrNull(String::class.java, FileResolver::class.java)
if (defaultConstructor != null && defaultConstructor.getAnnotation(java.lang.Deprecated::class.java) == null) {
// TODO: drop when gradle < 2.12 are obsolete
{ name, resolver -> defaultConstructor.newInstance(name, resolver) }
} else {
// (code omitted)
}
}
我们可以相信他们会及时解决问题,因此不必担心警告。
关于gradle - DefaultSourceDirectorySet 构造函数已被弃用。如何使用ObjectFactory服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53461821/
我是一名优秀的程序员,十分优秀!