Need Assistance with Gradle Dependencies in IntelliJ IDEA
Hello IntelliJ IDEA Hub Support,
I hope this message finds you well. I am an absolute beginner working on a project that involves customizing LWJGL and importing Gradle libraries. I have encountered an issue with my build.gradle.kts file, where the lwjglVersion, jomlVersion, and lwjglNatives variables are all highlighted in red. The project was set up with JDK 19, and I selected Gradle as the build tool during project creation in IntelliJ IDEA, using what I believe is the latest version of Gradle, given that I am using the latest version of IntelliJ IDEA.
Here is a snippet of my build.gradle.kts file:
plugins {
id("java-library")
}
group = "org.example"
version = "1.0-SNAPSHOT"
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
project.ext.lwjglVersion = "3.3.3"
project.ext.jomlVersion = "1.10.5"
project.ext.lwjglNatives = "natives-macos-arm64"
repositories {
mavenCentral()
}
dependencies {
implementation(platform("org.lwjgl:lwjgl-bom:${project.ext.lwjglVersion}"))
implementation("org.lwjgl:lwjgl")
implementation("org.lwjgl:lwjgl-assimp")
implementation("org.lwjgl:lwjgl-glfw")
implementation("org.lwjgl:lwjgl-nfd")
implementation("org.lwjgl:lwjgl-openal")
implementation("org.lwjgl:lwjgl-opengl")
implementation("org.lwjgl:lwjgl-stb")
runtimeOnly("org.lwjgl:lwjgl::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-assimp::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-glfw::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-nfd::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-openal::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-opengl::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-stb::$lwjglNatives")
implementation("org.joml:joml:${project.ext.jomlVersion}")
}
I would greatly appreciate any guidance on resolving this issue. As a beginner, I'm eager to learn and improve my skills.
Thank you for your time and assistance.
请先登录再写评论。
Hello!
It looks like
variables have been declared incorrectly. It should be
and then you should be able to refer to them as shown below