Search code examples
scalaintellij-ideasbtivy

Cannot Create IntelliJ Scala Project Due to Missing Ivy Module


I am using IntelliJ Community 2019.1. I am trying to create a new Scala project via SBT; however, when the project tries to build and dump project structure from SBT, I get the following error. SBT version 1.2.7; Scala version 2.11.12; JDK 1.8.0_202,

Error while importing sbt project:
[error] java.lang.NoClassDefFoundError: org/apache/ivy/core/module/id/ModuleRevisionId
[error]     at sbt.Keys$.<init>(Keys.scala:439)
[error]     at sbt.Keys$.<clinit>(Keys.scala)
[error]     at sbt.Cross$.$anonfun$requireSession$1(Cross.scala:78)
[error]     at sbt.Command$.$anonfun$applyEffect$3(Command.scala:142)
[error]     at sbt.Command$.$anonfun$combine$2(Command.scala:147)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
[error]     at scala.collection.immutable.List.foreach(List.scala:388)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:233)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
[error]     at scala.collection.immutable.List.map(List.scala:294)
[error]     at sbt.Command$.$anonfun$combine$1(Command.scala:147)
[error]     at sbt.Command$.process(Command.scala:180)
[error]     at sbt.MainLoop$.processCommand(MainLoop.scala:151)
[error]     at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:139)
[error]     at sbt.State$$anon$1.runCmd$1(State.scala:246)
[error]     at sbt.State$$anon$1.process(State.scala:250)
[error]     at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:139)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.MainLoop$.next(MainLoop.scala:139)
[error]     at sbt.MainLoop$.run(MainLoop.scala:132)
[error]     at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:110)
[error]     at sbt.io.Using.apply(Using.scala:22)
[error]     at sbt.MainLoop$.runWithNewLog(MainLoop.scala:104)
[error]     at sbt.MainLoop$.runAndClearLast(MainLoop.scala:59)
[error]     at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:44)
[error]     at sbt.MainLoop$.runLogged(MainLoop.scala:35)
[error]     at sbt.StandardMain$.runManaged(Main.scala:138)
[error]     at sbt.xMain.run(Main.scala:89)
[error]     at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]     at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]     at xsbt.boot.Launch$.run(Launch.scala:109)
[error]     at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]     at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]     at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]     at xsbt.boot.Boot$.runImpl(Boot.scala:56)
[error]     at xsbt.boot.Boot$.main(Boot.scala:18)
[error]     at xsbt.boot.Boot.main(Boot.scala)
[error] Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.module.id.ModuleRevisionId
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     at sbt.Keys$.<init>(Keys.scala:439)
[error]     at sbt.Keys$.<clinit>(Keys.scala)
[error]     at sbt.Cross$.$anonfun$requireSession$1(Cross.scala:78)
[error]     at sbt.Command$.$anonfun$applyEffect$3(Command.scala:142)
[error]     at sbt.Command$.$anonfun$combine$2(Command.scala:147)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
[error]     at scala.collection.immutable.List.foreach(List.scala:388)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:233)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
[error]     at scala.collection.immutable.List.map(List.scala:294)
[error]     at sbt.Command$.$anonfun$combine$1(Command.scala:147)
[error]     at sbt.Command$.process(Command.scala:180)
[error]     at sbt.MainLoop$.processCommand(MainLoop.scala:151)
[error]     at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:139)
[error]     at sbt.State$$anon$1.runCmd$1(State.scala:246)
[error]     at sbt.State$$anon$1.process(State.scala:250)
[error]     at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:139)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.MainLoop$.next(MainLoop.scala:139)
[error]     at sbt.MainLoop$.run(MainLoop.scala:132)
[error]     at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:110)
[error]     at sbt.io.Using.apply(Using.scala:22)
[error]     at sbt.MainLoop$.runWithNewLog(MainLoop.scala:104)
[error]     at sbt.MainLoop$.runAndClearLast(MainLoop.scala:59)
[error]     at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:44)
[error]     at sbt.MainLoop$.runLogged(MainLoop.scala:35)
[error]     at sbt.StandardMain$.runManaged(Main.scala:138)
[error]     at sbt.xMain.run(Main.scala:89)
[error]     at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]     at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]     at xsbt.boot.Launch$.run(Launch.scala:109)
[error]     at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]     at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]     at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]     at xsbt.boot.Boot$.runImpl(Boot.scala:56)
[error]     at xsbt.boot.Boot$.main(Boot.scala:18)
[error]     at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.NoClassDefFoundError: org/apache/ivy/core/module/id/ModuleRevisionId

I have tried re-installing IntelliJ, adding the apache ivy jars from Apache (and importing them in the build.sbt!), re-packaging, re-assembling, and restarting the IDE. None of which have worked to create a new project.

Any assistance in resolving the error is greatly appreciated. Thank you!


Solution

  • After a considerable amount of trial and error, Google searches, and frustration, I finally found and corrected the issue I was having!

    There was an sbt version conflict; I was attempting to use sbt 1.2.7, but when I upgraded to sbt 1.2.8, all has been working as expected. I am able to create new projects via sbt, and build existing projects I've cloned from my company's enterprise GitHub. I hope this can help someone else save hours of work and frustration!