Home > Software design >  Gradle: Could not find method plugins() for arguments
Gradle: Could not find method plugins() for arguments

Time:05-20

I am trying to update Gradle in my project (4.1 to 4.10 to start with). Currently any Gradle command is failing with this:

$ ./gradlew help --scan

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\path\to\update_gradle_4-to-5\settings.gradle' line: 2

* What went wrong:
A problem occurred evaluating settings 'stp_update_gradle_4-to-5'.
> Could not find method plugins() for arguments [settings_bahdvc7oyczkaknvtasx3cr06$_run_closure1$_closure2@5bd0fd5c] on object of type org.gradle.plugin.management.internal.DefaultPluginManagementSpec.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

OK. It is clearly telling me something is wrong with settings.gradle, but I honestly cannot figure out what.

settings.gradle

pluginManagement {
    plugins {
        id "com.moowork.node" version "${com_moowork_node_version}"
        id "io.spring.dependency-management" version "${io_spring_dependency-management_version}"
        id "net.ltgt.apt" version "${net_ltgt_apt_version}"
        id "org.sonarqube" version "${org_sonarqube_version}"
        id "org.springframework.boot" version "${spring_boot_version}"
    }
}
rootProject.name = 'hub'

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip

gradle.properties

assertj_version=3.6.2
awaitility_version=2.0.0
com_moowork_node_version=1.2.0
commons_io_version=2.5
commons_lang_version=3.5
cucumber_version=1.2.4
dropwizard_metrics_version=3.2.2 # Overridden to get metrics-jcache
elasticsearch_version=2.1.7.RELEASE
hibernate_version=5.2.10.Final
hikaricp_version=2.6.0
io_spring_dependency-management_version=1.0.11.RELEASE
jackson_version=2.8.7
javax_transaction_version=1.2
jhipster_server_version=1.1.9
jjwt_version=0.7.0
json_path_version=0.9.1
liquibase_hibernate5_version=3.6
liquibase_slf4j_version=2.0.0
logstash_logback_encoder_version=4.11
mapstruct_version=1.1.0.Final
metrics_spring_version=3.1.3
net_ltgt_apt_version=0.11
node_version=6.11.1
npm_version=5.3.0
org_sonarqube_version=2.5
problem_spring_web_version=0.20.0
profile=dev
prometheus_simpleclient_version=0.0.20
spring_boot_version=1.5.7.RELEASE
springfox_version=2.7.0
yarn_version=0.27.5

CodePudding user response:

pluginManagement was an incubating feature in Gradle 4.10 and did not support defining a plugins closure (user guide, DSL reference). plugins appeared first as incubating feature in Gradle 5.6.

  • Related