No compileOnly configuration in the build.gradle but it is

895 views Asked by At

I have the following error message during the build, but no compileOnly dependency in my build.gradle. Why it's happens, and how to solve? Regards

Resolving dependency configuration 'compileOnly' is not allowed as it is defined as 'canBeResolved=false'. Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'compileOnly' should be resolved.

buildscript {
    ext.kotlin_version = '1.6.0'

    repositories {
        mavenCentral()

        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }

        maven {
            url "https://plugins.gradle.org/m2/"
        }

        repositories {
            flatDir {
                dirs 'jars'
            }
        }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}


plugins {
    id "org.jetbrains.intellij" version "1.10.1"
    id "org.jetbrains.grammarkit" version "2020.1"

}

configurations {
    configurations.implementation.setCanBeResolved(true)
}

group 'com.interfaced'
version '0.2.7'

apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.intellij'

sourceSets {
    all {
        java.srcDirs += ['src/main/gen']
        kotlin.srcDirs += ['src/main/kotlin']
        resources.srcDirs = ['src/main/resources']
    }
}


grammarKit {
    jflexRelease = '1.7.0-2'
}

repositories {
    mavenCentral()
    maven {
        url "https://cache-redirector.jetbrains.com/intellij-dependencies"
    }
}

dependencies {
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
    compileClasspath  group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.7.22'

    compileClasspath  files('jars/grammar-kit.jar')
    compileClasspath  group: 'junit', name: 'junit', version: '4.12'
    compileClasspath  "org.jetbrains.kotlin:kotlin-stdlib-jdk7"

}

intellij {
    version '2022.3'
}

import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.grammarkit.tasks.GenerateParser

def GENERATE_GROUP = 'Generate'

task generateLexer(type: GenerateLexer) {
    source = "src/main/grammar/BrightScript.flex"
    targetDir = "src/main/gen/com/interfaced/brs/lang/lexer"
    targetClass = "_BrsLexer"
    skeleton = "src/main/grammar/idea-flex.skeleton"
    purgeOldFiles = true

    description = 'Generate Lexer Java sources for BrightScript'
    group = GENERATE_GROUP
}

task generateParser(type: GenerateParser) {
    source = "src/main/grammar/BrightScript.bnf"
    targetRoot = 'src/main/gen'
    pathToParser = 'src/main/gen/com/interfaced/brs/lang/BrsParser.java'
    pathToPsiRoot = 'src/main/gen/com/interfaced/brs/lang/psi'
    purgeOldFiles = true

    description = 'Generate Parser Java sources for BrightScript'
    group = GENERATE_GROUP

    // patch up to date check
    outputs.upToDateWhen { false }
}

compileKotlin {
    kotlinOptions.jvmTarget = "17"
}

compileKotlin.dependsOn(generateLexer, generateParser)
0

There are 0 answers