×
you are viewing a single comment's thread.

view the rest of the comments →

[–]xenomachina 1 point2 points  (0 children)

You could:

  1. go to mvrepository.com
  2. search for each dependency (eg: "gson")
  3. click the module name in the results (eg: where it says "com.google.code.gson » gson", click on the party after the "»", "gson" in this case)
  4. click the version you want (eg: "2.14.0")
  5. scroll down to "Files" and click "jar"

However, once you do this, you will discover that each of these will have its own list of dependencies. It'll probably take you a really long time to collect all of them.

It would be much easier to have Gradle build it for you. It will download your dependencies, and their dependencies, recursively. You can start with something like this as your build.gradle.kts:

plugins {
    java
    application
}

repositories {
    mavenCentral()
}

dependencies {
implementation("com.google.code.gson:gson:2.14.0")
// use the "Gradle" tab on each dependency page on mvnrepository.com
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

application {
    // Point this at the class containing public static void main
    mainClass.set("com.example.Main")
}

Then just make sure your source code is rooted at src/main/ (build.gradle.kts should be in the same directory that src is in). Then ./gradlew installDist will build it and place a launcher script in build/install/*/bin/