diff --git a/apps/routerconsole/build.gradle b/apps/routerconsole/build.gradle
index 000fa5cc8b5924477fcc60c3dcfa00f6a07491c5..77ae1e0eb14e7127d678ef305099c74250c53705 100644
--- a/apps/routerconsole/build.gradle
+++ b/apps/routerconsole/build.gradle
@@ -1,4 +1,5 @@
 apply plugin: 'war'
+apply plugin: 'scala'
 
 sourceSets {
     main {
@@ -6,6 +7,11 @@ sourceSets {
             srcDir 'java/src'
         }
     }
+    test {
+        scala {
+            srcDir 'java/test/scalatest'
+        }
+    }
 }
 
 dependencies {
@@ -16,7 +22,17 @@ dependencies {
     providedCompile project(':apps:systray')
     providedCompile project(':apps:jetty')
     providedCompile project(':apps:jrobin')
+
+    testCompile "org.scala-lang:scala-library:2.12.4"
+    testCompile 'org.scalatest:scalatest_2.12:3.0.4'
+}
+
+task scalaTest(dependsOn: ['testClasses'], type: JavaExec) {
+    main = 'org.scalatest.tools.Runner'
+    args = ['-R', 'build/classes/scala/test', '-o']
+    classpath = sourceSets.test.runtimeClasspath
 }
+test.dependsOn scalaTest
 
 jar {
     manifest {
diff --git a/build.gradle b/build.gradle
index af398cf737d275e33b7c90ccf5bed8655bede6ea..6eab507d8a16c075c170d04689a0fc7598832977 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,5 @@
+apply plugin: 'idea'
+
 // Exclude apps/ dir itself, but include its subdirs
 def javaProjects = subprojects - project(':apps')
 
diff --git a/core/build.gradle b/core/build.gradle
index ab2c6260c90d272d172903f955e8a256238b7ace..3214c9c6ef5636c84a331270e94055f02c39821a 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,4 +1,5 @@
 apply plugin: 'java-library'
+apply plugin: 'scala'
 
 archivesBaseName = 'i2p'
 
@@ -30,13 +31,26 @@ sourceSets {
             include 'net/i2p/crypto/eddsa/math/baseDblPrecmp'
             include 'net/i2p/crypto/eddsa/math/basePrecmp'
         }
+        scala {
+            srcDir 'java/test/scalatest'
+        }
     }
 }
 
 dependencies {
     implementation 'gnu.getopt:java-getopt:1.0.13'
     implementation 'org.gnu.gettext:libintl:0.18.3'
+
+    testCompile "org.scala-lang:scala-library:2.12.4"
+    testCompile 'org.scalatest:scalatest_2.12:3.0.4'
+}
+
+task scalaTest(dependsOn: ['testClasses'], type: JavaExec) {
+    main = 'org.scalatest.tools.Runner'
+    args = ['-R', 'build/classes/scala/test', '-o']
+    classpath = sourceSets.test.runtimeClasspath
 }
+test.dependsOn scalaTest
 
 configurations {
     tests