Skip to content

Setting up IDEA

AtonRay edited this page Mar 1, 2023 · 2 revisions

Setting up IDEA

On this page I will guide you through setting up IDEA and problems you will likely encounter.

At this point you should already have an installation of IntelliJ IDEA a git repository for your project or at least a project folder on your PC. Now open IDEA and set up a GitHub token for it unless you just want to work locally.

You can now clone your repository directly from IDEA through File -> New -> Project from Version Control....
file -> Open In the window that opens up you only need to specify the URL to your repository.

Alternatively, if you already have your project locally select File -> Open... from the top left corner in IDEA.
file -> Open
In the window that then opens navigate to your project directory and click OK.

After you opened the project IDEA will take some time to scan project structure and set itself up. During that it might run into an error that looks like this.
wrong java version error

That is caused by a wrong java version. To resolve it open File -> Project Structure....
File -> Project Structure
And select a Java 17 SDK from the dropdown in Project Settings -> Project. If there is none directly avaliable there is also an option to download one. It should not matter which one you choose as long as it is Java 17. But make sure that you select language level 8 in the dropdown below.
Project Structure

Now hit Apply and it might already resolve the error. If you still get the error you need to also change your Gradle JVM. To do so press shift twice and type Gradle JVM then click the top result or manually navigate to it in the settings File -> Settings.... You should end up with a window looking like the following image. Gradle JVM In the highlighted dropdown select Project SDK and hit Apply. Now the error should be gone.

Building the mod

There are two ways of building the mod. First I will talk about using a gradle task from within IDEA, which is what I recommend for building the mod. This requires you to have done the set-up from the last section. The other option is to build the mod from the command line.

Building the mod from IDEA

In IDEA there is a Gradle tab on the top right of the screen. Expand it and locate Tasks -> build -> build. You can then build the mod just by double-clicking that.
Gradle build task

Doing so will produce two jar packages, that can be found in ./build/libs/ in your project directory. The one which ends in dev.jar is not mapped and will not run. You can just ignore that.

Building the mod from the command line

This way of building the mod does not require you to set up any IDE. But you will need a java 17 JDK added to your path. You can get that here. If you don't already know how to add it to your path or are not familiar with the command line I would not advise going this way.

To build the mod you simply open a command line in the directory where you unpacked the source code and run . /gradlew build. This will build the jar, which you can then find in ./build/libs/.

Clone this wiki locally