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

Failed to apply plugin #12

Open
zageyiff opened this issue Jun 2, 2021 · 2 comments
Open

Failed to apply plugin #12

zageyiff opened this issue Jun 2, 2021 · 2 comments

Comments

@zageyiff
Copy link

zageyiff commented Jun 2, 2021

Hello,

Trying this plugin out on a existing project, I'm having this error

> gradle clean assemble

FAILURE: Build failed with an exception.

* Where:
Build file '/..../some-project/build.gradle.kts' line: 1

* What went wrong:
An exception occurred applying plugin request [id: 'com.github.burrunan.s3-build-cache', version: '1.1']
> Failed to apply plugin 'com.github.burrunan.s3-build-cache'.
   > class org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to class org.gradle.api.initialization.Settings (org.gradle.api.internal.project.DefaultProject_Decorated and org.gradle.api.initialization.Settings are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @48533e64)

* 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 945ms

I've tried with gradle 7.0.2 and 6.9, same error.
JDK is 15

If it helps, I'm attaching the output with the --stacktrace option
s3.cache.error.output.txt

@vlsi
Copy link
Contributor

vlsi commented Jun 2, 2021

Hi, are you trying to apply the plugin inside build.gradle.* file?

It should be applied within settings.gradle.*
For instance (note you need to add version depending on the way you manage plugin versions): https://github.com/pgjdbc/pgjdbc/blob/45a771fccd77c1211d8638111ee3e9934849b781/settings.gradle.kts#L36

@zageyiff
Copy link
Author

zageyiff commented Jun 3, 2021

Missed that part of the documentation that needed to be applied in the settings.gradle.*. It's working now 👍

The only two minor changes I had to do to the configuration, in our case using settings.gradle.kts

buildCache {
    local {
        isEnabled = false   // if left as `enabled`, Cannot access 'enabled': it is invisible (private in a supertype) in 'DirectoryBuildCache'
    }
    remote<com.github.burrunan.s3cache.AwsS3BuildCache> {
        //...
        isPush = isCiServer   // if left as `push`, Cannot access 'push': it is invisible (private in a supertype) in 'AwsS3BuildCache'
    }
}

This change works with gradle 6.9 and 7.0.2

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