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

Error: There is no feature named GRADLE_METADATA #37

Closed
takanuva15 opened this issue Apr 29, 2021 · 2 comments
Closed

Error: There is no feature named GRADLE_METADATA #37

takanuva15 opened this issue Apr 29, 2021 · 2 comments

Comments

@takanuva15
Copy link

takanuva15 commented Apr 29, 2021

Hi, I'm trying to get set up with this library for the first time so I can start using it. However, after following the instructions in #12 and running the gradle jar command, I keep getting this error: There is no feature named GRADLE_METADATA

I am confused how to proceed at this point? If I comment out that line, I get this error instead: KotlinSourceSet with name 'commonMain' not found. at build.gradle.kts' line: 27.

I am using Gradle 7.0 with Java 11. Below are my code files:

settings.gradle.kts
rootProject.name = "test"

enableFeaturePreview("GRADLE_METADATA")
build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    application
    kotlin("jvm") version "1.4.32"
}

group = "me.test"
version = "1.0-SNAPSHOT"

application {
    mainClass.set("MainKt")
}

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    api("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin-jvm:816803892c")
}

kotlin {
    sourceSets {
        val commonMain by getting {
            dependencies {
                api("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin:816803892c")
            }
        }
    }
}

tasks {
    withType<KotlinCompile> {
        kotlinOptions.jvmTarget = "11"
    }

    withType<Jar> {
        manifest {
            attributes["Main-Class"] = application.mainClass
        }
        exclude("**/module-info.class")
        from(configurations.runtimeClasspath.get().map {if (it.isDirectory) it else zipTree(it)})
    }

    test {
        useJUnitPlatform()
    }
}
@drieks
Copy link
Collaborator

drieks commented Apr 29, 2021

Hi @takanuva15,

GRADLE_METADATA was removed in Gradle 7.0, you can just remove this line, it is no longer required.

You are using the JVM-only Kotlin Plugin kotlin("jvm"), but commonMain is a Multiplatform (kotlin("multiplatform")) SourceSet name, please try just main or the multiplatform plugin.

kotlin {
    sourceSets {
        val main by getting {

@takanuva15
Copy link
Author

Sweet thanks! It's working now

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