简体   繁体   中英

Intellij doesn't recognize dependencies

i have a problem with Intellij. I have a dependency in gradle build file, when i use it in class and i will compile it with gradle it works without any problem, but intellij doesn't recognize classes in this one dependency.

plugins {
    id ("java")
    id ("org.jetbrains.kotlin.jvm") version "1.8.0"
}

group = "org.hypejet.exparkour"
version = "1.0"

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

dependencies {
    compileOnly("com.github.Minestom:Minestom:c995f9c3a9")
    compileOnly("com.github.HypeJet:HypeStom:4a6bf2a44a")
    compileOnly("org.mongodb:mongo-java-driver:3.12.11")
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}

I tried invalidating cache, removing.idea and.gradle folders, but nothing changed. I use kotlin and gradle kotlin dsl btw.

I run your gradle in command line, get error:

* What went wrong:
A problem occurred evaluating root project 'DemoKotlinApp2'.
> Could not find method maven() for arguments [https://jitpack.io] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

Your config

maven("https://jitpack.io")

I fix it to

    maven {
        url "https://jitpack.io"
    }

and re-run gradle , no more error message.

my gralde version: Gradle 7.6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM