0

I'm new to IntelliJ/Kotlin; in my .kts file:

plugins {
    id("java")
    id("io.spring.dependency-management") version "1.0.12.RELEASE"
    id("org.springframework.boot") version "2.7.0"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    google()
    mavenLocal()
    maven( "https://jitpack.io" )
    maven("https://maven.aliyun.com/repository/google/")
    maven("https://maven.aliyun.com/repository/public/")
    maven("https://maven.aliyun.com/repository/spring/")
    maven("https://maven.aliyun.com/repository/gradle-plugin/")
    maven("https://maven.aliyun.com/repository/spring-plugin/")
    mavenCentral()
    maven("https://plugins.gradle.org/m2")
}

dependencies {
    //https://medium.com/@krishnan.srm/springboot-kotlin-and-redis-great-partners-9207fe79c329
    implementation("org.springframework.data:spring-data-commons")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-data-redis")
    implementation("org.springframework.boot:spring-boot-starter-web")

    implementation("org.springframework.data:spring-data-redis:2.7.0")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

    //implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")

    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("org.springframework.boot:spring-boot-starter-mustache")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")      
}

}

but then in my Main.java,

import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

it doesn't recognize the "redis" part of the import ("redis" is in red, unresolved reference to redis)

What am I doing wrong?

Markus
  • 1,020
  • 14
  • 18

1 Answers1

0

It could be just a problem of refreshing the dependencies added in Gradle from IntelliJ, you can use the "Refresh dependencies":

right-click on the project name in the Gradle Tool Window and select Refresh dependencies from the context menu.

Reference: How can I force update all the snapshot Gradle dependencies in intellij

If this doesn't help, try on IntelliJ: File -> Invalidate Caches/Restart -> Invalidate and Restart (this option may vary depending by your IntelliJ version)

cdr89
  • 958
  • 9
  • 18