virtualdogbert / enterprise-groovy-plugin

A gradle plugin for adding @CompileStatic by default with optional configurable enforcement.
Apache License 2.0
8 stars 2 forks source link

Error in Groovy Plugin when Using Enterprise Groovy Plugin #17

Open sirinath opened 4 years ago

sirinath commented 4 years ago

I have the following

plugins {
    id "enterprise.groovy.plugin" version "1.0.5"
        id 'java'
    id 'groovy'
}

...

This gives:

An exception occurred applying plugin request [id: 'groovy']
> Failed to apply plugin [class 'org.gradle.api.plugins.GroovyBasePlugin']
   > Cannot change attributes of dependency configuration ':server:compileClasspath' after it has been resolved

When I remove the line id "enterprise.groovy.plugin" version "1.0.5" it builds without error.

virtualdogbert commented 4 years ago

Hmm haven't seen this error yet... what version of Gradle are you using, and can you create a sample app that reproduces the issue that I can test?

sirinath commented 4 years ago

No source code yet.

The following goes into build.gradle in a submodule

plugins {
    id "enterprise.groovy.plugin" version "1.0.5"
        id 'java'
    id 'groovy'
}

sourceCompatibility = 11
targetCompatibility = 11

ext {
    groovy = '3.0.4'
    picocli = '4.3.2'
    janino = '3.1.2'
    questdb = '5.0.1'
        activej = '1.0'
    babl = '0.4.1'
    pac4j = '4.0.2'
    eclipse_collections = '10.2.0'
    logback = '1.2.3'
    junit = '4.12'
}

dependencies {
    implementation group: 'org.codehaus.groovy', name: 'groovy', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-ant', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-astbuilder', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-cli-picocli', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-console', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-datetime', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-docgenerator', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-groovydoc', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-groovysh', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-jmx', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-jsr223', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-macro', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-nio', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-servlet', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-sql', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-swing', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-templates', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-test', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-test-junit5', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-testng', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-xml', version: "$groovy", classifier: 'indy'
    implementation group: 'org.codehaus.groovy', name: 'groovy-yaml', version: "$groovy", classifier: 'indy'

        implementation group: 'info.picocli', name: 'picocli', version: "$picocli"

    implementation group: 'org.codehaus.janino', name: 'janino', version: "$janino"

    implementation group: 'org.questdb', name: 'core', version: "$questdb"

    implementation group: 'io.activej', name: 'activej-launchers-http', version: "$activej"
    implementation group: 'io.activej', name: 'activej-http', version: "$activej"
    implementation group: 'io.activej', name: 'activej-inject', version: "$activej"
    implementation group: 'io.activej', name: 'activej-csp', version: "$activej"

    implementation group: 'io.activej', name: 'activej-test', version: "$activej"
    implementation group: 'io.activej', name: 'activej-jmxapi', version: "$activej"
    implementation group: 'io.activej', name: 'activej-common', version: "$activej"
    implementation group: 'io.activej', name: 'activej-fs', version: "$activej"
    implementation group: 'io.activej', name: 'activej-net', version: "$activej"
    implementation group: 'io.activej', name: 'activej-datastream', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-common', version: "$activej"
    implementation group: 'io.activej', name: 'activej-jmx-stats', version: "$activej"
    implementation group: 'io.activej', name: 'activej-bytebuf', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launcher', version: "$activej"
    implementation group: 'io.activej', name: 'activej-codegen', version: "$activej"
    implementation group: 'io.activej', name: 'activej-codec', version: "$activej"
    implementation group: 'io.activej', name: 'activej-eventloop', version: "$activej"
    implementation group: 'io.activej', name: 'activej-promise', version: "$activej"
    implementation group: 'io.activej', name: 'activej-triggers', version: "$activej"
    implementation group: 'io.activej', name: 'activej-ot', version: "$activej"
    implementation group: 'io.activej', name: 'activej-workers', version: "$activej"
    implementation group: 'io.activej', name: 'activej-rpc', version: "$activej"
    implementation group: 'io.activej', name: 'activej-boot', version: "$activej"
    implementation group: 'io.activej', name: 'activej-jmx', version: "$activej"
    implementation group: 'io.activej', name: 'activej-crdt', version: "$activej"
    implementation group: 'io.activej', name: 'activej-config', version: "$activej"
    implementation group: 'io.activej', name: 'activej-serializer', version: "$activej"
    implementation group: 'io.activej', name: 'activej-etl', version: "$activej"
    implementation group: 'io.activej', name: 'activej-servicegraph', version: "$activej"
    implementation group: 'io.activej', name: 'activej-aggregation', version: "$activej"
    implementation group: 'io.activej', name: 'activej-multilog', version: "$activej"
    implementation group: 'io.activej', name: 'activej-dataflow', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-dataflow', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-remotefs', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-crdt', version: "$activej"
    implementation group: 'io.activej', name: 'activej-cube', version: "$activej"
    implementation group: 'io.activej', name: 'activej-uikernel', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers', version: "$activej"
    implementation group: 'io.activej', name: 'activej-specializer', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-http', version: "$activej"
    implementation group: 'io.activej', name: 'activej-launchers-rpc', version: "$activej"
    implementation group: 'io.activej', name: 'activej', version: "$activej"
    implementation group: 'io.activej', name: 'activej-memcache', version: "$activej"

    implementation group: 'com.aitusoftware', name: 'babl', version: "$babl", ext: 'pom'

    implementation group: 'org.pac4j', name: 'pac4j', version: "$pac4j", ext: 'pom'
    implementation group: 'org.pac4j', name: 'pac4j-core', version: "$pac4j"
    implementation group: 'org.pac4j', name: 'pac4j-config', version: "$pac4j"
    implementation group: 'org.pac4j', name: 'pac4j-http', version: "$pac4j"
    implementation group: 'org.pac4j', name: 'pac4j-oauth', version: "$pac4j"

    implementation group: 'org.eclipse.collections', name: 'eclipse-collections-api', version: "$eclipse_collections"
    implementation group: 'org.eclipse.collections', name: 'eclipse-collections', version: "$eclipse_collections"

    implementation group: 'ch.qos.logback', name: 'logback-classic', version: "$logback"

    testImplementation group: 'junit', name: 'junit', version: "$junit"
}

Main module has:

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id 'base'
}

allprojects {
    apply plugin: 'base'

    repositories {
        mavenCentral()
        google()
        jcenter()
    }

    wrapper{
        gradleVersion = '6.5.1'
        distributionType = Wrapper.DistributionType.ALL
    }
}
virtualdogbert commented 4 years ago

Yeah, it might be the Gradle version... I know it works on 5.5, but I haven't tried it on 6.5 till right now and got the same issue. I may just have to update the version of Gradle I'm building with...

demus-nine commented 3 years ago

We see this as well and work around it thus:

gradle.projectsEvaluated {
    subprojects {
        apply plugin: 'enterprise.groovy.plugin'
    }
}
andersaaberg commented 2 years ago

We also experience this issue for Gradle 5.6 (Grails 4.0.13), Enterprise Groovy Plugin 1.0.5 - we could also fix it by applying Enterprise Groovy Plugin last using the old buildscript+apply notation:

buildscript {
    dependencies {
        classpath "com.virtualdogbert:enterprise-groovy-plugin:1.0.5"
    }
}

// apply other plugins first
apply plugin: "enterprise.groovy.plugin"

It would be much nicer to just use the plugin notation:

plugins {
    id 'enterprise.groovy.plugin' version '1.0.5'
}