Skip to content

Replace deprecated Groovy property assignment syntax in spring-aspects.gradle #36131

@thelightway24

Description

@thelightway24

Environment

  • OS: Windows 11
  • Gradle Version: 9.2.1
  • Affected File: spring-aspects/spring-aspects.gradle

Description

I encountered deprecation warnings related to Gradle 10 compatibility while building the spring-aspects module. The spring-aspects/spring-aspects.gradle file currently uses the legacy Groovy DSL syntax (space-separated values) for property assignment.

According to the Gradle roadmap, this syntax is deprecated in Gradle 9.x and will be removed in Gradle 10.

Steps to Reproduce

Run the build with warning mode enabled:

./gradlew :spring-aspects:clean :spring-aspects:assemble --warning-mode=all

Observed Logs:

> Configure project :spring-aspects
Build file 'spring-framework\spring-aspects\spring-aspects.gradle': line 6
Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('sourceCompatibility = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at spring_aspects_575w5t6jqkkupsy94quu3ruls$_run_closure1.doCall$original(spring-framework\spring-aspects\spring-aspects.gradle:6)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at spring_aspects_575w5t6jqkkupsy94quu3ruls.run(spring-framework\spring-aspects\spring-aspects.gradle:5)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file 'spring-framework\spring-aspects\spring-aspects.gradle': line 7
Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('targetCompatibility = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at spring_aspects_575w5t6jqkkupsy94quu3ruls$_run_closure1.doCall$original(spring-framework\spring-aspects\spring-aspects.gradle:7)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at spring_aspects_575w5t6jqkkupsy94quu3ruls.run(spring-framework\spring-aspects\spring-aspects.gradle:5)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file 'spring-framework\spring-aspects\spring-aspects.gradle': line 13
Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('sourceCompatibility = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at spring_aspects_575w5t6jqkkupsy94quu3ruls$_run_closure2.doCall$original(spring-framework\spring-aspects\spring-aspects.gradle:13)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at spring_aspects_575w5t6jqkkupsy94quu3ruls.run(spring-framework\spring-aspects\spring-aspects.gradle:12)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file 'spring-framework\spring-aspects\spring-aspects.gradle': line 14
Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('targetCompatibility = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/9.2.1/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at spring_aspects_575w5t6jqkkupsy94quu3ruls$_run_closure2.doCall$original(spring-framework\spring-aspects\spring-aspects.gradle:14)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at spring_aspects_575w5t6jqkkupsy94quu3ruls.run(spring-framework\spring-aspects\spring-aspects.gradle:12)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)


[Incubating] Problems report is available at: file:///spring-framework/build/reports/problems/problems-report.html

Cause

In spring-aspects/spring-aspects.gradle, properties are currently set using the following syntax:

sourceCompatibility "17"
targetCompatibility "17"

Gradle 10 will remove support for this "space-separated" or "parenthesis-less" method call syntax for property assignment.

Solution

I propose updating the property declarations to use the standard assignment operator (=).
This ensures compatibility with Gradle 10 and aligns with modern Groovy/Kotlin DSL best practices.

Proposed Change

sourceCompatibility = "17"
targetCompatibility = "17"

ref: Gradle User Guide: Groovy Space Assignment Syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions