IntelliJ IDEA Setup¶
- Navigate to "New Project" from any view
-
Select Gradle -> Java as the type of Project and make sure the correct JDK is selected (Java 8 or higher)
-
Let IntelliJ index your project.
-
Open
build.gradle.kts
-
Populate the build file with the following
plugins { application id("com.gradleup.shadow") version "8.3.1" } application.mainClass = "com.example.discordbot.Bot" // (1) group = "org.example" version = "1.0" val jdaVersion = "JDA_VERSION_HERE" // (2) repositories { mavenCentral() } dependencies { implementation("net.dv8tion:JDA:$jdaVersion") } tasks.withType<JavaCompile> { options.encoding = "UTF-8" options.isIncremental = true // Set this to the version of java you want to use, // the minimum required for JDA is 1.8 sourceCompatibility = "1.8" }
-
Replace the
mainClass
value with the path to your main class later on! -
Replace the
JDA_VERSION_HERE
with the one mentioned in the latest release
-
-
Reload Gradle and wait for it to finish
-
If IntelliJ IDEA didn't already do so automatically, set up a source folder as
src/main/java
- Create your group package. Example:
com.example.discordbot
- Make your main class. Example:
Bot.java
. Your directory tree should look like this:ProjectName -> src/main/java -> com/example/discordbot -> Bot.java -> gradle/wrapper -> gradle-wrapper.properties -> gradle/wrapper -> gradle-wrapper.jar -> build.gradle.kts -> settings.gradle.kts
- Configure the
mainClass
value in thebuild.gradle.kts
to your class. Example:com.example.discordbot.Bot
-
To build your finished project simply use the
shadowJar
task in your Gradle tool window on right hand side of your editor. > You can also run your project with therun
Gradle task! -
This will build a jar in
build/libs
. The one with the-all
suffix is the shadow jar. - Continue with Getting Started
- Navigate to "New Project" from any view
-
Select Gradle -> Java as the type of Project and make sure the correct JDK is selected (Java 8 or higher)
-
Let IntelliJ index your project.
-
Open
build.gradle.kts
-
Populate the build file with the following
plugins { application id("com.gradleup.shadow") version "8.3.1" } application.mainClass = "com.example.discordbot.Bot" // (1) group = "org.example" version = "1.0" val jdaVersion = "JDA_VERSION_HERE" // (2) repositories { mavenCentral() } dependencies { implementation("net.dv8tion:JDA:$jdaVersion") } tasks.withType<JavaCompile> { options.encoding = "UTF-8" options.isIncremental = true // Set this to the version of java you want to use, // the minimum required for JDA is 1.8 sourceCompatibility = "1.8" }
-
Replace the
mainClass
value with the path to your main class later on! -
Replace the
JDA_VERSION_HERE
with the one mentioned in the latest release
-
-
Reload Gradle and wait for it to finish
-
If IntelliJ IDEA didn't already do so automatically, set up a source folder as
src/main/java
- Create your group package. Example:
com.example.discordbot
- Make your main class. Example:
Bot.java
. Your directory tree should look like this:ProjectName -> src/main/java -> com/example/discordbot -> Bot.java -> gradle/wrapper -> gradle-wrapper.properties -> gradle/wrapper -> gradle-wrapper.jar -> build.gradle.kts -> settings.gradle.kts
- Configure the
mainClass
value in thebuild.gradle.kts
to your class. Example:com.example.discordbot.Bot
-
To build your finished project simply use the
shadowJar
task in your Gradle tool window on right hand side of your editor. > You can also run your project with therun
Gradle task! -
This will build a jar in
build/libs
. The one with the-all
suffix is the shadow jar. - Continue with Getting Started