Skip to content

Applying the gradle plugin directly in the subproject does not work #795

@kun-zhou

Description

@kun-zhou

I am trying to add the Gradle plugin to a subproject directly like so

plugins {
    id 'application'
    id "com.diffplug.spotless" version "5.10.0"
}

without a build.gradle for the root project. But ./gradlew b fails due to

* What went wrong:
Execution failed for task ':spotlessInternalRegisterDependencies'.
> Could not resolve all files for configuration ':detachedConfiguration2'.
   > Cannot resolve external dependency com.google.googlejavaformat:google-java-format:1.7 because no repositories are defined.
     Required by:
         project :

However, if I add the plugin to the root project first or add a repository in the buildscript in the root build.gradle, the issue is resolved. I am curious why this is the case. I understand spotless use the buildscript of the root project but it eludes why including the plugin in the root project without defining the build script works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions