Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Can't add gradle dependency to classpath

BattleDash opened this issue ยท 2 comments

commented

What do you need help with?

I'm working on a fork of baritone, and it requires Java-WebSocket, however I've tried everything and it refuses to be added to the classpath. I've never used gradle before (I prefer maven) but I asked around and no one has ever heard of runtime launchCompile(), which is what is used in the build.gradle for dependencies. I've tried everything, in every syntax, compile, runtime, implementation, etc, and nothing works. It compiles fine, and Java-WebSocket is available in IntelliJ runs, but in the built jar when using in production Java-WebSocket isn't in the classpath. It was suggested that I upgrade the gradle version from 4.9, but that caused proguard issues, I know I might get harped for making an issue about this but I've tried every other avenue, making an issue on here is my only other idea.

Simplified build.gradle:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'org.java-websocket:Java-WebSocket:1.4.0'
    }
}

dependencies {
    runtime launchCompile('org.java-websocket:Java-WebSocket:1.4.0')
}

Final checklist

  • I know how to properly use check boxes
  • I have not used any OwO's or UwU's in this issue.
commented

For gradle, you should use implementation dependencies.

The problem is, that the dependency won't be packed into your final jar. It will only be referenced in it. If you were using that jar as a dependency somewhere, then Java-WebSocket would be added. But Minecraft cannot resolve those dependencies.

What you should look into is called 'fatjar'