Skip to content

FEAT: Gradle 9.6: Do not pass a Project object directly as a dependency notation #900

Description

@mmoayyed

Describe the solution you'd like

Using plugin version 1.1.1, if the plugin is applied to a Gradle project that uses Gradle 9.6 and above, the following warning shows up:

Using a Project object as a dependency notation has been deprecated. This will fail
with an error in Gradle 10. Please use the project(String) method on DependencyHandler or the createProjectDependency(String) 
method on DependencyFactory instead. Consult the upgrading guide for further information: 
https://docs.gradle.org/9.6.0-rc-1/userguide/upgrading_version_9.html#dependency_project_notation

This is most likely because of this line:

compileOnly.getDependencies().add(project.getDependencies().create(project));

The scope of this request to allow the plugin to support Gradle 9.6's recommended way of adding dependencies, hopefully in a such a way that older Gradle versions may also be supported if backward compatibility is a factor.

Thank you!

Describe alternatives you've considered

The recommendation from the Gradle team is:

Instead, use the project() method on DependencyHandler or the createProjectDependency() method on DependencyFactory:

dependencies {
    implementation(project(":some-project"))
}

Having consulted with the Gradle team, the only way to remove the warning at the moment is to disable/remove the plugin.

Additional context

Gradle 9.6 as of this writing is at RC1, though as the warning suggests, this will be removed in Gradle 10. As of now, this is just a warning and does not cause the build to fail though that might also change in newer Gradle versions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions