Benny
Benny

Reputation: 49

Do an exclusion in build.gradle?

I want to add an exclusion to my build.gradle because my jar doesnt run after I compile it. The problem can be fixed if some modules are excluded. How do I do that correctly? The following code should fix the problem:

compile ("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
        exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
    }

Upvotes: 0

Views: 1501

Answers (1)

braebdeb
braebdeb

Reputation: 293

For the most recent gradle versions (7+), you need to use the new syntax implementation or compileOnly. This should also be in a dependencies block as shown below:

dependencies {
    implementation("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
        exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
    }
}

See for more info

However for gradle 6 and below, your compile block should work fine inside a dependencies block.

Upvotes: 2

Related Questions