ItsNova
ItsNova

Reputation: 23

(LWJGL 3.2.3) build.gradle won't build when implementing LWJGL components

Can someone help me? My "build.gradle" won't build when implementing LWJGL and JOML.

Here's my build.gradle:

project.ext.lwjglVersion = "3.2.3"
project.ext.jomlVersion = "1.10.2"
project.ext.lwjglNatives = "natives-windows"

repositories {
    mavenCentral()
}

dependencies {
    implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")

    implementation "org.lwjgl:lwjgl"
    implementation "org.lwjgl:lwjgl-assimp"
    implementation "org.lwjgl:lwjgl-glfw"
    implementation "org.lwjgl:lwjgl-openal"
    implementation "org.lwjgl:lwjgl-opengl"
    implementation "org.lwjgl:lwjgl-stb"
    implementation "org.lwjgl:lwjgl-tinyfd"
    runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives"
    implementation "org.joml:joml:${jomlVersion}"
}

When building, it returns this error:

Gradle sync failed: Could not find method implementation() for arguments [DefaultExternalModuleDependency{group='org.lwjgl', name='lwjgl-bom', version='3.2.3', configuration='default'}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. (5 s 872 ms)

Upvotes: 1

Views: 1608

Answers (1)

httpdigest
httpdigest

Reputation: 5797

The presented build.gradle file is not a complete build.gradle file, lacking the "implementation" configuration. If you simply copied the snippet generated by lwjgl.org/customize then this would not give you a complete working build.gradle file. You still have to include some Gradle plugin such as "application" that will make the "implementation" configuration available.

So, in order to fix this, add the following at the very top of your build.gradle file:

plugins {
    id 'application'
}

Upvotes: 1

Related Questions