Closed snowe2010 closed 5 years ago
It appears that the project version being 4.10 might be the reason.
It looks like a mismatch between the Gradle version and the org.gradle.kotlin.kotlin-dsl
plugin version.
With a build.gradle.kts
, simply do:
plugins {
`kotlin-dsl`
}
instead of
plugins {
id("org.gradle.kotlin.kotlin-dsl") version "1.0.5"
}
Yes, I forgot to close this after realizing that it could be solved that way. I still think the error message should be updated though, as it's not very clear.
Companion object is being created for some internal type in gradle's kotlin-dsl. I have no Companion objects in any of my code.
Expected Behavior
No failure here.
Current Behavior
Building of plugin succeeds, but attempts at applying it to a project result in the below error.
Here is a link to the relevant plugin code
Here is the result of
javap -verbose -private net/researchgate/release/ReleasePlugin.class
which seems to be the source of the Companion error.Notice that the 'Companion' reference is in
Lorg/gradle/kotlin/dsl/TaskContainerScope$Companion;
Here is a pared down version (still duplicates the issue) of the
build.gradle
Context
This is blocking us from switching to gradle from maven, and I've been stuck on this problem for about a week now. Quite frustrating. A lot of the struggle is from trying to convert an existing plugin to gradle 5 and kotlin at the same time. The jump from 1.12 to 5 is quite large.
Steps to Reproduce (for bugs)
Build this plugin
using another project with this plugin declared
Run a clean
and you should get a stacktrace like above.
Your Environment
gradle --version
:Gradle version of project:
Gradle version of plugin:
About
menu you can copy version information)Configure Kotlin Plugin Updates
preference panel)1.3.11-release-IJ2018.3-1