IntelliJ Setup: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
Mcroft (talk | contribs)
/* Updated for GitHub
Alium (talk | contribs)
Added steps to confirm gradle runShadow and how to build/run/debug
Line 23: Line 23:
# Click the '''+''' button to add a build file
# Click the '''+''' button to add a build file
# Choose build.gradle from the file selector and press Open
# Choose build.gradle from the file selector and press Open
#Run Configurations should contain <code>kolmafia [runShadow]</code>. If it does not, continue to the next steps.
#In the Gradle Toolbar click on the elephant to Execute Gradle Task
#A window titled ''Run Anything'' will popup. Search for <code>runShadow</code> and select it


=== From the Gradle Menu, select Applications>run ===
===How to build and run/debug===
#Click the drop down in the top right and select the desired option
##<code>kolmafia [runShadow]</code> is the application itself
##<code>Tests in 'KoLMafia'</code> are the unit tests
#Click the play button to build and run
#Or click the bug button to build and debug

Revision as of 03:04, 18 February 2022

KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.

IntelliJ IDEA is an IDE for developing Java applications. This guide assumes that you have a recent enough version of Java JDK, Ant, and IntelliJ IDEA. Completing Compiling from Source is a requirement for this guide, although experienced developers can skip to whatever step is appropriate.

The following instructions are based on IntelliJ IDEA 2021.2 Community Edition. Instructions for other versions/editions of IntelliJ may be slightly different.

Create a Project

Create a new project

  1. Start IntelliJ IDEA. In the Welcome to IntelliJ IDEA dialog, click Get from VCS.
  2. In the Get from Version Control dialog, select the Repository URL tab.
    1. In Version control, select GitHub.
    2. Add a new repository location. To do so, click the + button next to Repositories.
    3. In the New Repository Location popup, enter the URL to KoLmafia's GitHub repository. If you have a GitHub account and a Personal Access Token, use git@github.com:kolmafia/kolmafia.git If you do not have a GitHub account, use https://github.com/kolmafia/kolmafia.git
    4. Click OK to close the popup.
    5. Once the repository has been added, click the repository URL to highlight it, then click Check Out.
  3. If the Destination Directory popup appears, choose a directory to check out the working copy.
    Caution: Don't choose a common directory like C:\Users\<username>\Documents. Instead, create a new directory under it (by clicking the folder icon) and give it an appropriate name (e.g. kolmafia).

    Click OK to continue.
  4. IntelliJ will generate a new project. If it asks you whether to add kolmafia.iml to Subversion, you may click Cancel to skip it

Add the Gradle Build File

  1. Open the Gradle Toolbar Item (typically on the right side, and not very large)
  2. Click the + button to add a build file
  3. Choose build.gradle from the file selector and press Open
  4. Run Configurations should contain kolmafia [runShadow]. If it does not, continue to the next steps.
  5. In the Gradle Toolbar click on the elephant to Execute Gradle Task
  6. A window titled Run Anything will popup. Search for runShadow and select it

How to build and run/debug

  1. Click the drop down in the top right and select the desired option
    1. kolmafia [runShadow] is the application itself
    2. Tests in 'KoLMafia' are the unit tests
  2. Click the play button to build and run
  3. Or click the bug button to build and debug