Skip to content

Use assignment to set repository url in Groovy Gradle builds #1656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

hpoettker
Copy link
Contributor

Summary

Gradle builds using Groovy, which use custom Maven repositories like the Spring milestone or snapshot repos, currently log deprecation warnings as they use the syntax

maven { url 'https://repo.spring.io/snapshot' }

instead of the preferred

maven { url = 'https://repo.spring.io/snapshot' }

Gradle's guidance on this is available here: https://docs.gradle.org/8.14/userguide/upgrading_version_8.html#groovy_space_assignment_syntax

The PR resolves this issue.

How to reproduce

In the Spring Initializr, build a Gradle project with Groovy and choose a Spring Boot snapshot release.

When one then executes for example

./gradlew clean --warning-mode all

the build will log

Settings file 'settings.gradle': line 3
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.0. Use assignment ('url = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.14/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at settings_8j6gtdsyzf202bs1oyal9e9vj$_run_closure1$_closure2$_closure3.doCall$original(settings.gradle:3)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at settings_8j6gtdsyzf202bs1oyal9e9vj$_run_closure1$_closure2.doCall$original(settings.gradle:3)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

> Configure project :
Build file 'build.gradle': line 18
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.0. Use assignment ('url = <value>') instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.14/userguide/upgrading_version_8.html#groovy_space_assignment_syntax
        at build_4owna3ovmuwuctycxsbmt7eu6$_run_closure2$_closure6.doCall$original(build.gradle:18)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at build_4owna3ovmuwuctycxsbmt7eu6$_run_closure2.doCall$original(build.gradle:18)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 5, 2025
@mhalbritter
Copy link
Contributor

Hello,

thanks for the PR. This fixes the warning in the settings.gradle file, however in the build.gradle file I still got this:

repositories {
	mavenCentral()
	maven { url 'https://repo.spring.io/milestone' }
	maven { url 'https://repo.spring.io/snapshot' }
}

Could you fix that in GroovyDslGradleBuildWriter, too?

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Jun 5, 2025
Signed-off-by: Henning Pöttker <25299532+hpoettker@users.noreply.github.com>
@hpoettker hpoettker force-pushed the gradle-groovy-deprecation-warning branch from 03cf774 to 4e507ba Compare June 5, 2025 10:20
@hpoettker
Copy link
Contributor Author

done

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 5, 2025
@mhalbritter mhalbritter added type: enhancement and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Jun 5, 2025
@mhalbritter mhalbritter self-assigned this Jun 5, 2025
@mhalbritter mhalbritter changed the title Use assignment to set url in Groovy Gradle builds Use assignment to set repository url in Groovy Gradle builds Jun 6, 2025
mhalbritter pushed a commit that referenced this pull request Jun 6, 2025
See gh-1656

Signed-off-by: Henning Pöttker <25299532+hpoettker@users.noreply.github.com>
@mhalbritter
Copy link
Contributor

Thanks @hpoettker !

@mhalbritter mhalbritter added this to the 0.22.0 milestone Jun 6, 2025
@hpoettker hpoettker deleted the gradle-groovy-deprecation-warning branch June 6, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants