Code Monkey home page Code Monkey logo

Comments (8)

wolfs avatar wolfs commented on May 13, 2024 1

When importing a project in intellij when I apply the build scan plugin from an init script like this:

initscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2"
        }
    }
    dependencies {
        classpath "com.gradle:build-scan-plugin:1.8"
    }
}
rootProject { prj ->
    apply plugin: initscript.classLoader.loadClass("com.gradle.scan.plugin.BuildScanPlugin")
    buildScan {
        publishAlways()
    }
}

I get the following error in IDEA:

Error:Failed to compile accessors
    projectSchema: ProjectSchema(extensions={ext=org.gradle.api.plugins.ExtraPropertiesExtension, buildScan=com.gradle.scan.plugin.internal.api.f}, conventions={}, configurations=[])
    classPath: [/Users/wolfs/.gradle/caches/4.1-20170707032407+0000/generated-gradle-jars/gradle-api-4.1-20170707032407+0000.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/groovy-all-2.4.11.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/gradle-installation-beacon-4.1.jar, /Users/wolfs/.gradle/caches/4.1-20170707032407+0000/generated-gradle-jars/gradle-kotlin-dsl-extensions-0.10.0-SNAPSHOT-4.1-20170707032407+0000.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/gradle-kotlin-dsl-0.10.0-SNAPSHOT.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/gradle-kotlin-dsl-compiler-plugin-0.10.0-SNAPSHOT.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/gradle-kotlin-dsl-tooling-models-0.10.0-SNAPSHOT.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/kotlin-reflect-1.1.3-2.jar, /Users/wolfs/.gradle/wrapper/dists/gradle-kotlin-dsl-4.1-20170707032407+0000-all/d3mj6o6gozo0alzok0r3j1q50/gradle-4.1-20170707032407+0000/lib/kotlin-stdlib-1.1.3-2.jar]

I would expect this to work or at least give me a better error message what I should do.

from gradle.

bamboo avatar bamboo commented on May 13, 2024

Blocked by gradle/kotlin-dsl-samples#416.

from gradle.

bamboo avatar bamboo commented on May 13, 2024

Just to explain the behaviour reported here, the latest release provides extension accessors by default. This requires the types of all extensions to be visible in the build script classpath but currently initscript dependencies are not thus the type of the buildScan extension is not visible and compilation fails.

This behaviour can be disabled via a Gradle project property:

org.gradle.kotlin.dsl.accessors=off

from gradle.

pioterj avatar pioterj commented on May 13, 2024

I'm using the following init.d script to enable build scans in all my builds:

initscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2"
        }
    }
    dependencies {
        classpath "com.gradle:build-scan-plugin:1.8"
    }
}

rootProject {
    apply plugin: com.gradle.scan.plugin.BuildScanPlugin
    buildScan {
        publishAlways()
        if (project.hasProperty("useProdScanServer")) {
            licenseAgreementUrl = "https://gradle.com/terms-of-service"
            licenseAgree = "yes"
        } else {
            server = "https://internal.gradle.enterprise.server"
        }
    }
}

Importing official Kotlin DSL samples to IDEA results in the following error:

Error:The build scan plugin must be applied early in the build lifecycle.
Fixing this problem requires changing how you are applying the build scan plugin to your build.
Please see https://gradle.com/scans/help/plugin-late-apply for how to resolve this problem.

from gradle.

bamboo avatar bamboo commented on May 13, 2024

@pioterj, I get the same error with a Groovy based build script so there's something else going on here.

from gradle.

bamboo avatar bamboo commented on May 13, 2024

The following project reproduces the issue with a Groovy build script on the latest 4.1 nightly:

from gradle.

stale avatar stale commented on May 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

from gradle.

stale avatar stale commented on May 13, 2024

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

from gradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.