You are currently viewing How Do I Resolve This Type Mismatch?

How Do I Resolve This Type Mismatch?

So I was working on converting my build.gradle (Which uses Groovy) to a build.gradle.kts (Which uses Kotlin) and this is what I got so far:

Groovy Original:

plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.3.72' id 'com.github.johnrengelman.shadow' version '5.2.0' } group 'com.smushytaco' version '1.0-SNAPSHOT' repositories { mavenCentral() maven { url 'https://papermc.io/repo/repository/maven-public/' } } dependencies { implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.3.72' //https://papermc.io/javadocs/paper/1.16/overview-summary.html compileOnly group: 'com.destroystokyo.paper', name: 'paper-api', version: '1.16.1-R0.1-SNAPSHOT' } shadowJar { getArchiveClassifier().set('') project.configurations.implementation.canBeResolved = true configurations = [project.configurations.implementation] relocate 'kotlin', 'com.smushytaco.src.main.kotlin.com.smushytaco.plugin' } build.dependsOn shadowJar 

Kotlin Conversion:

plugins { java kotlin("jvm") version("1.3.72") id("com.github.johnrengelman.shadow") version("5.2.0") } group = "com.smushytaco" version = "1.0-SNAPSHOT" repositories { mavenCentral() maven("https://papermc.io/repo/repository/maven-public/") } dependencies { implementation("org.jetbrains.kotlin", "kotlin-stdlib", "1.3.72") //https://papermc.io/javadocs/paper/1.16/overview-summary.html compileOnly("com.destroystokyo.paper", "paper-api", "1.16.1-R0.1-SNAPSHOT") } tasks { shadowJar { archiveClassifier.set("") project.configurations.implementation.get().isCanBeResolved = true // Type Mismatch: // Required: (Mutable)List<Configuration!>! //Found: Array<NamedDomainObjectProvider<Configuration>> configurations = [project.configurations.implementation] relocate("kotlin", "com.smushytaco.src.main.kotlin.com.smushytaco.plugin") } build { dependsOn(shadowJar) } } 

I commented the error I’m getting with the Kotlin rewrite, why does it work with the original Groovy one and not with this one? How do I fix this error?

submitted by /u/SmushyTaco
[link] [comments]