Skip to content

IntelliJ run configurations

elisa lee edited this page Jan 24, 2023 · 5 revisions

Intro

This page guides us through setting up IntelliJ's run configurations to run the app via IntelliJ.

Prerequisites

Setup

Caveat

  • Make sure you didn't already open the repo in IntelliJ
  • If you mess up somewhere, do sudo rm -rf .idea in the project root to start from scratch

After opening the project,

  • You should see the following alerts appear in the lower right-hand corner.
Screen Shot 2022-05-06 at 3 38 48 PM
  • Click "Load"

  • You may also see a popup up that asks you if you want to yarn install, feel free to do this now although it's not strictly necessary

  • Open the backend/src/main/java/gov/cdc/usds/simplerepot/SimpleReportApplication.java file in IntelliJ

  • You should see a banner near the top of the editor, saying "Module JDK is not defined", click "Setup SDK".

Screen Shot 2022-05-06 at 3 40 39 PM
  • That should open a dropdown. You should click the appropriate "Oracle OpenJDK version"
Screen Shot 2022-05-06 at 3 47 03 PM
  • Once that is done, you should start seeing green arrows to the right of the line numbers in that file
Screen Shot 2022-05-06 at 3 52 59 PM
  • To the left of the green hammer, you should click the dropdown and select "Edit Configurations..."
Screen Shot 2022-05-09 at 12 06 54 PM
  • That should open a new window called "Run/Debug Configurations",

With Okta

  • Open the "Spring Boot" tab and click "Backend with Okta".
Screen Shot 2022-07-29 at 10 49 25 AM
  • Set the following:
    • "Active profiles:" to okta-local,local
    • "Environment variables:" to the values in the repository's .env file as a comma-separated list and without the double quotes (e.g. SMARTY_AUTH_ID=123,SMARTY_AUTH_TOKEN=123,OKTA_API_KEY=123)
    • Ask a developer for these values

Without Okta

  • Ensure the "Backend" run configuration only has the "Active profiles:" set to dev (This should be the default)

Prevent the browser from opening when starting the app (optional)

  • open the "npm" tab and click "Frontend" or "Frontend with Okta".

  • Set "Environment:" to BROWSER=none and click "Apply". Ignore the other options.

Screen Shot 2022-05-06 at 3 57 50 PM

Running the debugger for the frontend

  1. Have the appropriate backend running
  2. Start the frontend by selecting the frontend run configuration you want, and pressing the green play button
Screen Shot 2023-01-24 at 11 34 30
  1. In the "Run" tab for the frontend run configuration you just started, find the URL that the console prints:
Screen Shot 2023-01-24 at 11 36 58
  1. On a Mac, CMD + Shift + click that URL
  2. A new browser window should open.
  3. Set breakpoints on the frontend code in IntelliJ where you would like the application to break on.
  4. Your debugger should now be working!

Local development

Setup

How to

Development process and standards

Oncall

Technical resources

How-to guides

Environments/Azure

Misc

?

Clone this wiki locally