BreadMoirai / github-release-gradle-plugin

A Gradle Plugin to send Releases to Github
Apache License 2.0
108 stars 26 forks source link

NoClassDefFoundError with Gradle 5.0 #9

Closed jmccance closed 5 years ago

jmccance commented 5 years ago

Seeing a NoClassDefFoundError when trying to run under Grade 5.0. Looks like AbstractProvider was removed or renamed somewhere between 4.10.2 and 5.0.

These also appear to be unstable/internal APIs even in 5.0, so it might be worth exploring an alternative approach.

https://gist.github.com/jmccance/b9cf65834de2c4fbd82effc5c7728d86

stewartbryson commented 5 years ago

I'm seeing this as well.

xeruf commented 5 years ago

Same here, this is urgent! It prevents me from upgrading everything to gradle 5.0!

akasolace commented 5 years ago

I observe something strange (at least to me). I tried to use the plugin in 2 ways:

option 1)

apply plugin: 'com.github.breadmoirai.github-release'
githubRelease {

    def _token = GITHUB_TOKEN 
    owner = xxx
    repo = xxx
    releaseAssets.from("$target_dir")

    body {
        token = _token
        if (releaseArtefacts) {
            if (development_stage == '0') {
                tagName = "DEV"
                releaseName = "DEV"
                targetCommitish = "master"
                body = "Latest development version (aimed at developers).\nBuild ... Release on ...."
                prerelease = true
                overwrite = false
                println("DEVELOPMENT version has been released on GitHub")
            } else if (development_stage == '1') {
                tagName = "BETA"
                releaseName = "BETA"
                targetCommitish = "master"
                body = "..................."
                prerelease = true
                overwrite = true
                println("BETA version has been released on GitHub.\nBuild ... Release on ....")
            } 
        }
    }}

this fails with the following error:

FAILURE: Build failed with an exception. What went wrong: okhttp3/OkHttpClient Exception is: java.lang.NoClassDefFoundError: okhttp3/OkHttpClient

option 2 (the one I would eventually like to use, i.e use plugin only if certain requirements are met):

task ReleaseToGitHub() {
    group 'tool'

    if (releaseArtefacts && ['0', '1''].contains(development_stage) && upstreamFixed) {
        println("I apply")
        apply plugin: 'com.github.breadmoirai.github-release'
        githubRelease {

            def _token = GITHUB_TOKEN  // required token for your personal access with repo permissions
            owner = 'akasolace'
            repo = 'HO'

            println("$target_dir")
            releaseAssets.from("$target_dir")
            println(releaseAssets)

            body {
                token = _token
                if (releaseArtefacts) {
                    if (development_stage == '0') {
                        tagName = "DEV"
                        releaseName = "DEV"
                        targetCommitish = "master"
                        body = "Latest development version (aimed at developers).\nBuild ... Release on ...."
                        prerelease = true
                        overwrite = false
                    } else {
                        tagName = "BETA"
                        releaseName = "BETA"
                        targetCommitish = "master"
                        body = "..................."
                        prerelease = true
                        overwrite = true
                    }  }  }  }  }}

in that case the task is running without error, it goes though the statement but does not do anything

Could you please tell me what I am doing wrong? Thank you

BreadMoirai commented 5 years ago

@akasolace Try adding this to the top of your build file

buildscript {
  repositories {
    jcenter()
  }
} 
akasolace commented 5 years ago

I already have a repositories { jcenter() }

if I enclose it into a buildscript block then it breaks if I simply add that extra block it does not change anything. I have the same behaviour as the one described above.