由于缺少常春藤模块,无法创建IntelliJ Scala项目

时间:2019-06-06 15:34:10

标签: scala intellij-idea sbt ivy

我正在使用IntelliJ Community 2019.1。我正在尝试通过SBT创建一个新的Scala项目;但是,当项目尝试从SBT构建和转储项目结构时,出现以下错误。 SBT版本1.2.7; Scala版本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

我尝试重新安装IntelliJ,从Apache添加apache ivy jar(并将它们导入build.sbt!),重新打包,重新组装并重新启动IDE。没有一个人创建新项目。

在解决错误方面提供的任何帮助都将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:0)

经过大量的反复试验,谷歌搜索和沮丧之后,我终于找到并纠正了我遇到的问题!

存在sbt版本冲突;我试图使用sbt 1.2.7,但是当我升级到sbt 1.2.8时,所有功能都按预期工作。我能够通过sbt创建新项目,并构建从我公司的企业GitHub克隆的现有项目。我希望这可以帮助其他人节省工作时间和挫败感!