Skip to content

Instantly share code, notes, and snippets.

@canweriotnow canweriotnow/idea.org
Last active Aug 16, 2019

Embed
What would you like to do?

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.

@zawaki

This comment has been minimized.

Copy link

zawaki commented Aug 20, 2016

thanks so much! saved me a lot of trouble!

@endofhome

This comment has been minimized.

Copy link

endofhome commented Sep 8, 2016

Thanks! This was helpful.

@livmaria7891

This comment has been minimized.

Copy link

livmaria7891 commented Feb 9, 2017

Thank you for this! I'm new to Java and IntelliJ, and for some reason the @ignore in the tests isn't working (.. the tests aren't skipping). Did you have a similar issue?

@upuld

This comment has been minimized.

Copy link

upuld commented Mar 18, 2018

Thanks for this!

@alimcg86

This comment has been minimized.

Copy link

alimcg86 commented May 23, 2018

So helpful! Been struggling for a while to get this working as a newbie to IntelliJ.
Thanks!!

@ptyxs

This comment has been minimized.

Copy link

ptyxs commented Mar 11, 2019

Fine, but I would like for all the exercises in a specific exercism track to be included in a unique project (say "kotlin_exercisms", for instance, including every Kotlin exercise and bash_exercisms including every Bash exercises...), with each exercise being a separate module or just a separate file. As I see it, it seems that your proposal makes each exercism exercise to be a separate project, isn'it ?

@ptyxs

This comment has been minimized.

Copy link

ptyxs commented Mar 11, 2019

I found the answer to my preceding message on Stackoverflow : https://stackoverflow.com/questions/8774024/intellij-working-on-multiple-projects
Particularly the item by ThisIsFlorianK.

@dbc2201

This comment has been minimized.

Copy link

dbc2201 commented Jul 24, 2019

@canweriotnow Thank you so much, it was such a hassle to move through all of those directories just to execute everything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.