nebula-plugins / gradle-info-plugin

Plugin to gather information about the environment
Apache License 2.0
49 stars 20 forks source link

Build Error java.lang.NoSuchMethodError: org.gradle.api.provider.ProviderFactory.systemProperty(Ljava/lang/String;)Lorg/gradle/api/provider/Provider; #67

Closed Bwvolleyball closed 4 years ago

Bwvolleyball commented 4 years ago

We recently started seeing this error in our builds:

Gradle version 5.6.4.

./gradlew build --stacktrace

//...

* Exception is:

java.lang.NoSuchMethodError: org.gradle.api.provider.ProviderFactory.systemProperty(Ljava/lang/String;)Lorg/gradle/api/provider/Provider;
    at nebula.plugin.info.basic.BasicInfoPlugin$_apply_closure1.doCall(BasicInfoPlugin.groovy:76)
    at org.gradle.util.ClosureBackedAction.execute(ClosureBackedAction.java:71)
    at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:154)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:105)

I'm not sure if this line is the root cause, but it seems to be new? https://github.com/nebula-plugins/gradle-info-plugin/blob/master/src/main/groovy/nebula/plugin/info/basic/BasicInfoPlugin.groovy#L76

DanielThomas commented 4 years ago

You picked up a major release. See https://github.com/nebula-plugins/gradle-info-plugin/releases/tag/v8.0.0

Bwvolleyball commented 4 years ago

In our build, we were specifying an old version, which I guess was being ignored - is there some other mechanism that would have bumped us immediately to the latest version?

DanielThomas commented 4 years ago

A long time ago now Gradle broke plugin publishing in a way that meant that it was publishing the requested dynamic constraints for a plugin, rather than the exact version. If you were using one of the affected plugin versions and it bundles info it could have upgraded you.

You can use the buildEnvironment task to check.

Bwvolleyball commented 4 years ago

A long time ago now Gradle broke plugin publishing in a way that meant that it was publishing the requested dynamic constraints for a plugin, rather than the exact version. If you were using one of the affected plugin versions and it bundles info it could have upgraded you.

😱

Thanks for the quick responses, and this explanation. I was very confused how that could have affected us without some magic bumping us to the latest version, I guess this'll be a fun root cause to solve, but thanks for the insight!