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 无法删除文件时,它现在将提供扩展诊断。这有助于解决锁定文件、并发写入等问题。

更多详情可查看发布公告。


相關推薦

2023-12-05

、PHP、JavaScript 和其他编程语言。 一些更新内容包括: Gradle 返回所有 loaders 的最高质量 #6371 将 Gradle Tooling API 更新到 8.4 #6553 不要在每个项目上都要求代理 #6558 #6536、#6537:避免堆栈溢出,捕获要下载的丢失

2023-04-02

Wine 8.5 已发布,用于在 Linux 和其他平台下运行 Windows 游戏和应用程序。 Wine 8.5 版本已将新的 VKD3D 1.7 代码库引入其树中。 VKD3D 1.7 于上周发布,添加了额外的 HLSL 功能、大量内部函数、调用用户定义函数的能力,以及一系列

2023-02-14

Gradle 8.0 现已发布。Gradle 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化构建工具,支持依赖管理和多项目,类似 Maven,但比之简单轻便。它使用一种基于 Groovy 的特定领域语言来声明项目

2022-11-12

p;"FreezingIsDeprecated" 的弃用信息并没有真正的帮助 Tools. Gradle. Multiplatform KT-54387 移除 MPP alpha 稳定性警告 KT-48436 误报 "The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation" Tools. JPS KT-454

2022-11-27

Gradle 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化构建工具,支持依赖管理和多项目,类似 Maven,但比之简单轻便。它使用一种基于 Groovy 的特定领域语言来声明项目设置,而不是传统的 XML。 Gradle 7.6 现已发布,此版本

2024-02-06

Gradle 8.6 现已发布。Gradle 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化构建工具,支持依赖管理和多项目,类似 Maven,但比之简单轻便。它使用一种基于 Groovy 的特定领域语言来声明项目

2023-11-15

tifactId> <version>4.0.2</version> </dependency> Gradle 依赖配置: com.github.ifeilong:feilong:4.0.2 本次升级共有 7 处变更, 具体参见 4.0.2 milestone 🍖 feilong-json #618 ✨ 新建 LongToDateMorpher,支持json转bean

2021-11-17

人可以看看 Rocky Linux 和 AlmaLinux,它们都已经发布了基于 RHEL 8.5 的版本。

2023-07-11

小伙伴逃不过法眼了。 插件式快速集成 (支持 maven 和 gradle 插件)。 支持 Apache Dubbo rpc 文档生成。 支持国产 Solon 应用开发框架。 Smart-doc 和其他工具的支持 功能特性 smart-doc swagger 代码侵入 无 注解侵入性

2023-07-14

注释支持得到了极大的改进,即支持嵌套注释。 Gradle 构建 可以将任意代码片段添加到 Gradle 构建中。 Maven 构建 添加对 Maven 扩展的支持。 对 Gradle 8 的支持 提供对 Gradle 8 的支持。 依赖升级 Spri

2022-08-07

Gradle 7.5.1 现已发布。Gradle 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化构建工具,支持依赖管理和多项目,类似 Maven,但比之简单轻便。它使用一种基于 Groovy 的特定领域语言来声明项目设

2022-11-02

提供。升级到 Elastic 8.5 版后,您可以使用 HNSW(现已正式发布)的矢量搜索功能更智能地进行搜索,更快地诊断日志速率峰值,并分配案例以便于协作。Elastic Cloud 8.5 版还提供了一个新的运行状况页面,可以轻松识别和解决集群

2022-11-03

小伙伴逃不过法眼了。 插件式快速集成 (支持 maven 和 gradle 插件)。 支持 Apache Dubbo rpc 文档生成。 支持国产 Solon 应用开发框架。 Smart-doc 和其他工具的支持 功能特性 smart-doc swagger 代码侵入 无 注解侵入性

2023-09-10

DGIOT v4.8.5 已经发布,工业物联网持续集成平台 此版本更新内容包括: 功能: 1.添加大屏编辑器动态添加低代码控件 2.添加mqtt动态推送大屏低代码控件 3.添加低代码控件动态绑定产品设备数据源 4.添加手机号码获取地理位置 5