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.
- [ ]
- [ ] Run
gradle ideato generate the
*.iml* and =.ideafiles/dirs
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
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?
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.