Gradle 8.5 发布,支持 Java 21
Gradle 8.5 现已发布。Gradle 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化构建工具,支持依赖管理和多项目,类似 Maven,但比之简单轻便。它使用一种基于 Groovy 的特定领域语言来声明项目设置,而不是传统的 XML。
Gradle 现在支持在 Java 21 上运行。此版本对 Kotlin DSL 进行了改进,包括更快的 first use 以及预编译 Kotlin 脚本插件中的版本目录支持。此外还提供了更多有用的错误和告警消息、改进了 build init 和依赖项验证,以及为构建和插件作者提供的几个新 API。
完整的 Java 21 支持
Gradle 8.4 支持使用 Java 工具链编译和测试 Java 21,但还不支持在 Java 21 上运行 Gradle 本身。新版本发布后,Gradle 现在完全支持在 Java 21 上编译、测试和运行。
详情可参阅完整的兼容性文档。
Kotlin DSL 改进
与传统的 Groovy DSL 相比,Gradle 的 Kotlin DSL 在支持的 IDE 中提供了更好的编辑体验:自动完成、智能内容辅助、快速访问文档、源代码导航和上下文感知重构。
- 首次使用速度更快:首次使用 Gradle 版本时,Gradle 会比以前更快地开始编译构建逻辑。
- 预编译脚本中的版本目录 API:
versionCatalogs
扩展访问器现在可用于 Kotlin DSL 预编译脚本。
// buildSrc/src/main/kotlin/my-convention-plugin.gradle.kts versionCatalogs // This is the extension now available .named("libs") // Assumes there is a libs catalog, throws exception otherwise .findLibrary("assertj-core") // Search the catalog for an assertj-core entry .ifPresent { assertjCore -> // If there is one ... dependencies { // ... Add a dependency to it testImplementation(assertjCore) } }
- 能够为脚本编译启用 Kotlin 元数据版本检查
错误和告警报告改进
- 改进了使用 reserved names 创建配置时的弃用消息。弃用警告示例:
Configure project : The configuration customCompileOnly was created explicitly. This configuration name is reserved for creation by Gradle. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Do not create a configuration with the name customCompileOnly. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#configurations_allowed_usage When creating configurations during sourceSet custom setup, Gradle found that configuration customCompileOnly already exists with permitted usage(s): Consumable - this configuration can be selected by another project as a dependency Resolvable - this configuration can be resolved by this project to a set of files Declarable - this configuration can have dependencies added to it Yet Gradle expected to create it with the usage(s): Declarable - this configuration can have dependencies added to it Gradle will mutate the usage of configuration customCompileOnly to match the expected usage. This may cause unexpected behavior. Creating configurations with reserved names has been deprecated. This will fail with an error in Gradle 9.0. Create source set custom prior to creating or accessing the configurations associated with it. For more information, please refer to https://docs.gradle.org/8.5/userguide/building_java_projects.html#sec:implicit_sourceset_configurations in the Gradle documentation.
- 改进了运行测试时对封装断言错误的处理
- 无法删除文件时提供更好的诊断:当 Gradle 无法删除文件时,它现在将提供扩展诊断。这有助于解决锁定文件、并发写入等问题。
更多详情可查看发布公告。

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
微软发布跨平台机器学习框架 ML.NET 3.0
微软近日正式发布 ML.NET 3.0,带来了许多新功能和改进。 ML.NET 是一个开源、跨平台的机器学习框架,专为 .NET 开发者设计,可以将自定义的机器学习模型集成到 .NET 应用程序中。 在这个版本中,深度学习方案得到了大幅扩展——引入了目标检测 (Object Detection)、命名实体识别 (Named Entity Recognition) 和问答 (Question Answering) 等新功能。这些功能得以实现,得益于与 TorchSharp 和 ONNX 模型的集成和互操作性。同时,该版本还将集成的 LightGBM 升级到了最新版本。 数据处理方面也有很大的改进,DataFrame 引入了一系列增强和错误修复,使得数据的加载、检查、转换和可视化等步骤更加强大。 在 ML.NET 3.0 中,开发者可以利用这些先进的功能来处理深度学习、自然语言处理等机器学习任务。例如,可以使用 ML.NET 的目标检测 API 来定位和分类图像中的实体,还可以使用 ML.NET 的命名实体识别和问答训练器来处理自然语言处理任务。 此外,ML.NET 3.0 还引入了 In...
- 下一篇
【店滴云】后台 diy 表单生成增强,满足多种输入要求
【店滴云】后台diy表单生成增强,满足多种输入要求 1、输入框输入,输入框类型处理 2、二级联动处理 3、编辑器初始化 4、数据联动显示处理 export const form = { 'blocs': { 'type': 'cascader-store', 'label': '选择公司' }, 'ishot': { 'type': 'radio', 'label': '是否热门', isOptions: true, options: [{ text: '是', value: 1 }, { text: '否', value: 2 } ] }, pcate: { label: '一级分类', // 只需要在这里指定为 tree-select 即可 type: 'tree-select', // 属性参考: https://vue-treeselect.js.org/ attrs: { multiple: false, clearable: true }, options: async data => { consol...
相关文章
文章评论
共有0条评论来说两句吧...