Skip to content

Project Setup

pgavigan edited this page May 21, 2019 · 11 revisions
Step 1: Download & Set-up Gradle

Follow the instructions from the Gradle site here.

Ensure that the gradle executable has been set-up in your path correctly by running the following in a command prompt or terminal: gradle -v

Please restart any open IDEs so that they pick up the changes to the PATH variable.

Step 2: Clone Repository

Clone the repository by running the following command:

git clone https://github.com/NMAI-lab/SAVI.git

Step 3a: Command Line Project (No IDE)

This project can be run from the command line using Gradle. Please skip to step 4.

Step 3b: Import Gradle Project (IntelliJ Users Only)

  1. Open IntelliJ IDEA

  2. If you get the Welcome to IntelliJ IDEA dialog, continue to Step 3. Otherwise, skip to Step 4.

  3. Import Project -> Skip to Step 5.

  4. File -> New -> Project From Existing Sources

  5. Navigate the dialog box to where the repository was cloned, select the build.gradle file, and click Ok.

  6. Ensure that "Use auto-import" is checked. Select the "Use local Gradle distribution" radio button, and ensure that Gradle home points to the directory where Gradle was installed. Leave all other options as-is and select Ok.

  7. Allow IntelliJ some time to index the files, download the Gradle dependencies, and set-up the project. Once this is complete, your development environment has been set up.

Step 3c: Import Gradle Project (Eclipse Users Only)

  1. Open Eclipse

  2. File -> Import... -> Gradle -> Existing Gradle Project -> Click Next.

  3. Click Next if you get the Welcome Screen

  4. Under Project root directory, enter the path for the cloned repository. Click Finish.

  5. The project has been imported successfully.

Step 4: Running the Simulation

There are two ways of running the simulation:
  1. Using an IDE (Eclipse / IntelliJ / etc.): You can start the simulation by running the SAVI_Controller class, located in savi/simulation.

  2. Using a command prompt or terminal: gradle run

Optional: Creating a Runnable Jar File

Creating a cross-platform JAR for the simulation can be done in one simple command: gradle buildJar.

The JAR file will be located under build/libs.

Additional Gradle Resources for Getting Started

Gradle utilizes the same project structure as Maven, so you can use this resource to understand how the project is laid out: Directory Structure

An additional resource for understanding Gradle directories and files can be found here.

Clone this wiki locally