So, you want to use IntelliJ IDEA for your Exercism.io Java exercises?
Here’s my workflow. Note, using IntelliJ IDEA CE 14.
- [ ]
cd
to$EXERCISM_DIR/java/the-exercise
- [ ] Run
gradle idea
to generate the*.iml* and =.idea
files/dirs
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.
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.
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?
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.
thanks so much! saved me a lot of trouble!