From 83a9098245ba7bc0ebeb6ccc49da3e6bacac948e Mon Sep 17 00:00:00 2001
From: Michael Vorburger <mike@vorburger.ch>
Date: Wed, 18 Oct 2017 23:49:35 +0200
Subject: [PATCH] Add eclipse plugin with correct configuration to build.gradle

Signed-off-by: Michael Vorburger <vorburger@redhat.com>
---
 README.md    |  5 +++++
 build.gradle | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/README.md b/README.md
index da9c8b02d..c55238f6e 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,11 @@ Each exercise is created as a failing unit test and your job is to make it pass.
 
 Here https://www.jetbrains.com/help/idea/gradle.html you can read how to work with Gradle projects in IntelliJ IDEA.
 
+##### Working with the project using Eclipse:
+
+1. Run `./gradlew eclipse` (this creates the correct .project and .classpath required by Eclipse)
+2. Import the project as Existing Project
+
 ##### Working with the commandline
 
 You can also build the project and run all tests in the terminal:
diff --git a/build.gradle b/build.gradle
index eb21e3c30..ec38b7022 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,7 @@ buildscript {
 }
 
 apply plugin: 'kotlin'
+apply plugin: 'eclipse'
 
 sourceSets {
     main.java.srcDirs += 'src'
@@ -26,3 +27,16 @@ dependencies {
     compile 'com.google.guava:guava:16.0'
     testCompile 'junit:junit:4.12'
 }
+
+eclipse {
+    project {
+        natures 'org.jetbrains.kotlin.core.kotlinNature'
+        buildCommand 'org.jetbrains.kotlin.ui.kotlinBuilder'
+        linkedResource(
+            name: 'kotlin_bin',
+            type: '2',
+            locationUri: "org.jetbrains.kotlin.core.filesystem:/${name}/kotlin_bin".toString()
+        )
+    }
+    classpath.containers 'org.jetbrains.kotlin.core.KOTLIN_CONTAINER'
+}