Skip to content
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

cannot apply plugin #9

Open
nkiesel opened this issue Dec 3, 2020 · 4 comments
Open

cannot apply plugin #9

nkiesel opened this issue Dec 3, 2020 · 4 comments

Comments

@nkiesel
Copy link

nkiesel commented Dec 3, 2020

I removed all my includes from settings.gradle and added id("com.pablisco.gradle.automodule") version "0.15" as the last entry in my existing top-level build.gradle. However, when running gradle jar I now get

An exception occurred applying plugin request [id: 'com.pablisco.gradle.automodule', version: '0.15']
> Failed to apply plugin [id 'com.pablisco.gradle.automodule']
> org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to org.gradle.api.initialization.Settings

This is with Gradle 5.6.4

BTW: I first tried to add the plugin into settings.gradle because the instructions say: "replace includes with the plugin line" but that was not working either. Thus added to build.gradle instead. Perhaps you can improve the instructions to make it clearer where to add the plugin line.

@pablisco
Copy link
Owner

pablisco commented Dec 4, 2020

What error do you get when applying it to the settings.gradle file? It should not be used in the top level build script... You can see from the error that it's expecting a Settings scope.

Can you provide some code of what have you tried? Also, it may be helpful to see how it's used inside the demo folder :)

@pablisco
Copy link
Owner

pablisco commented Dec 4, 2020

Also, I think the instructions are ok, but I welcome any improvement as a PR :)

@nkiesel
Copy link
Author

nkiesel commented Dec 4, 2020

I added it at line 1 in settings.gradle:

plugins {
    id("com.pablisco.gradle.automodule") version "0.15"
}

The error I get is:

  • Where:
    Settings file '/home/nkiesel/work/Platform/settings.gradle' line: 1
  • What went wrong:
    Could not compile settings file '/home/nkiesel/work/Platform/settings.gradle'.
    startup failed:
    settings file '/home/nkiesel/work/Platform/settings.gradle': 1: Only Project build scripts can contain plugins {} blocks
    See https://docs.gradle.org/5.6.4/userguide/plugins.html#sec:plugins_block for information on the plugins {} block

For the record: currently, my settings.gradle starts with

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven {
            name "ext-release-local"
            url "http://msjenkins:8081/artifactory/ext-release-local"
        }
    }

    plugins {
        id "com.gradle.build-scan" version Versions.com_gradle_build_scan_gradle_plugin
        id "org.sonarqube" version Versions.org_sonarqube_gradle_plugin
        id "de.fayard.buildSrcVersions" version Versions.de_fayard_buildsrcversions_gradle_plugin
        id "com.palantir.jacoco-full-report" version Versions.com_palantir_jacoco_full_report_gradle_plugin
        id "org.ajoberstar.grgit" version Versions.org_ajoberstar_grgit_gradle_plugin
        id "com.github.voplex95.lesscompiler" version Versions.com_github_voplex95_lesscompiler_gradle_plugin
        id "com.moowork.node" version Versions.com_moowork_node_gradle_plugin
        id "com.moowork.grunt" version Versions.com_moowork_grunt_gradle_plugin
        id "com.bmuschko.cargo" version Versions.com_bmuschko_cargo_gradle_plugin
        id "org.jetbrains.kotlin.jvm" version Versions.org_jetbrains_kotlin_jvm_gradle_plugin
        id "org.jlleitschuh.gradle.ktlint" version Versions.org_jlleitschuh_gradle_ktlint_gradle_plugin
        id "io.gitlab.arturbosch.detekt" version Versions.io_gitlab_arturbosch_detekt
        id 'net.ltgt.errorprone' version Versions.net_ltgt_errorprone_gradle_plugin
    }
}

@nkiesel
Copy link
Author

nkiesel commented Dec 15, 2020

Any suggestions on how to proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants