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' }
Advertisement
Answer
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' } }
However for gradle 6 and below, your compile
block should work fine inside a dependencies
block.