Skip to content

Instantly share code, notes, and snippets.

@patrickbeeson
Forked from canweriotnow/idea.org
Created April 23, 2020 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickbeeson/9a15055d033d99cdf11481e6638a157a to your computer and use it in GitHub Desktop.
Save patrickbeeson/9a15055d033d99cdf11481e6638a157a to your computer and use it in GitHub Desktop.

Exercism and IntelliJ IDEA

So, you want to use IntelliJ IDEA for your Exercism.io Java exercises?

Here’s my workflow. Note, using IntelliJ IDEA CE 14.

Gradle setup

  • [ ] cd to $EXERCISM_DIR/java/the-exercise
  • [ ] Run gradle idea to generate the *.iml* and =.idea files/dirs

IntelliJ

Open IntelliJ. If a project is already open, close it.

You should see the opening dialog.

Choose “Open”. Do not choose “Create new project”, “Import Project”, or anything else.

Navigate to the exercise folder, i.e. the folder just under java/ where the exercise lives. Select it, and choose “open.”

IntelliJ will try to open it like an existing IntelliJ project (which, thanks to gradle, it sort of is), rather than initiating the Rube Goldbergian “import” process which is really designed to make Eclipse projects unmanageable by Eclipse.

A wild dialog appears!

This is IntelliJ letting you know, BEHOLD, it perceives a Gradle project and would like to synchronize it for your pleasure. Click the link in that dialog. A second one will open just below that, if you keep your whole exercism directory in Git like I do. Ignore that one.

Gradle options. Wat do?

Okay, working from memory here, there will be a couple of checkboxes, unchecked by default. One is for auto-imports. Select it, this will make FEST and other things get pulled in through the Gradle dependency.

The other has to do with stubbing non-existent or empty folders or such.

You want that too, since the project only comes with test/src/ProjectTest.java and you also want main/src/Project.java - this will help you out there.

The next options get confusing. Where is my GRADLE HOME? Lost to the Cylons?

Doesn’t matter, because gradle made you some local custom wrapper scripts, so choose the radio button that says something about custom wrapper something.

The last choice is a select box for your Java runtime. Choose 1.8 if you can, since the Exercism java help page says use Java 8.

Why do we need Java 8? Well in addition to Java 7’s generics and annotations, you’ll obviously need lambda expressions to complete HelloWorld.java.

just kidding, choosing 1.7 probably won’t break anything but why wouldn’t you choose Java 8 if you can?

Fin

At this point, you should have a working project which will have all kinds of red squigglies in the test file which is referencing at least one class and method you have yet to write. So get writing, and run the damn tests!.

Oh, and have fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment