2013-05-02 23 views
16

Çalıştığım almaya çalışıyorum this multi-module build configuration var, ama aşağıdaki hata ile başarısız proje derlemeye çalıştığınızda zaman:başarısız "MissingRequirementError: derleyici aynada nesne scala.runtime bulunamadı."?

➜ postgresql-netty git:(multi-module) sbt clean compile 
[info] Loading global plugins from /Users/mauricio/.sbt/plugins 
[info] Loading project definition from /Users/mauricio/projects/scala/postgresql-netty/project 
[info] Set current project to db-async-base (in build file:/Users/mauricio/projects/scala/postgresql-netty/) 
[success] Total time: 0 s, completed May 1, 2013 11:18:29 PM 
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}db-async-common... 
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}db-async-base... 
[info] Resolving org.specs2#scalaz-core_2.10;7.0.0 ... 
[info] Done updating. 
[info] Resolving org.scala-lang#scala-library;2.10.1 ... 
[info] Done updating. 
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}postgresql-async... 
[info] Resolving ch.qos.logback#logback-classic;1.0.9 ... 
[info] Compiling 16 Scala sources to /Users/mauricio/projects/scala/postgresql-netty/db-async-common/target/scala-2.10/classes... 
[info] Resolving org.specs2#scalaz-core_2.10;7.0.0 ... 
[info] Done updating. 
scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found. 
    at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16) 
    at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17) 
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48) 
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40) 
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61) 
    at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172) 
    at scala.reflect.internal.Mirrors$RootsBase.getRequiredPackage(Mirrors.scala:175) 
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage$lzycompute(Definitions.scala:181) 
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage(Definitions.scala:181) 
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass$lzycompute(Definitions.scala:182) 
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass(Definitions.scala:182) 
    at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr$lzycompute(Definitions.scala:1015) 
    at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr(Definitions.scala:1014) 
    at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses$lzycompute(Definitions.scala:1144) 
    at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses(Definitions.scala:1143) 
    at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode$lzycompute(Definitions.scala:1187) 
    at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode(Definitions.scala:1187) 
    at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1252) 
    at scala.tools.nsc.Global$Run.<init>(Global.scala:1289) 
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:87) 
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:72) 
    at xsbt.CompilerInterface.run(CompilerInterface.scala:27) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73) 
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:35) 
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29) 
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:71) 
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71) 
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71) 
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101) 
    at sbt.compiler.AggressiveCompile$$anonfun$4.compileScala$1(AggressiveCompile.scala:70) 
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88) 
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60) 
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24) 
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22) 
    at sbt.inc.Incremental$.cycle(Incremental.scala:52) 
    at sbt.inc.Incremental$.compile(Incremental.scala:29) 
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:20) 
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96) 
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44) 
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31) 
    at sbt.Compiler$.apply(Compiler.scala:79) 
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:574) 
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:574) 
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578) 
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578) 
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49) 
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) 
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) 
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41) 
    at sbt.std.Transform$$anon$5.work(System.scala:71) 
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) 
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) 
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) 
    at sbt.Execute.work(Execute.scala:238) 
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) 
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) 
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) 
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 
[error] (db-async-common/compile:compile) scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found. 
[error] Total time: 4 s, completed May 1, 2013 11:18:33 PM 

bu nedir ve bunu nasıl düzeltebilirim fikrin var mı?

cevap

12

bir proje bağımlılık olarak scala-library ekleme:

"org.scala-lang" % "scala-library" % "2.10.1" 

trick yaptı. Hala bunun neden gerekli olduğundan emin değil ama daha önce olmadı. Bir yapı tanımında libraryDependencies için bağımlılıkları eklemek için := değil ++= veya += kullanarak, yani senin ayarlarken açık tüm proje yukarı bağımlılıkları zaman

+0

Ben aynı sorunu vardı ve Projemde * Bütün * ekstra dosyaları kaldırarak düzelttim:

sonuç aşağıdaki gibi olacak. Sadece tüm 'hedef /' dirs, ancak tüm 'proje/hedef /' dirs de (Ben ikinci onu çözdüm biri olduğunu düşünüyorum ve onlar sbt clean' 'tarafından kaldırılıyor değildi). – Dan

+2

Doğru çözüm olduğunu düşünmüyorum. * Scala * lib, * scalaVersion * ile belirtilen sürümle otomatik olarak çekilmelidir. Temizliği denemelisiniz, sonra her şeyi yeniden inşa etmelisiniz. – davidshen84

16

konudur, build.sbt söz: Bütün := ile

libraryDependencies := Dependencies.microservice 

libraryDependencies yılında ayarlıyoruz setleri SBT cari bağımlılıkları dışarı temizlenir ve sadece kullanılabilir bağımlılıkları (yukarıdaki örnekte olduğu gibi) Dependencies.microservice gelen bunlar.

"org.scala-lang" % "scala-library" % "2.10.1" Ekleme (veya kullandığınız scalaVersion sürümü), zaten düzgün bir şekilde başlatılmış olan libraryDependencies ayarının temizlenmesi için bir geçici çözümdür.

Bu şu inşa tanımıyla çoğaltmak kolay bulunuyor - build.sbt: yanlışlıkla Scala dosyaların sonuçları derlemek çalışılıyor

libraryDependencies := Seq() 

- show libraryDependencies not: aşağıdaki

➜ clear-library-dependencies xsbt 
JAVA_HOME=/Library/Java/JavaVirtualMachines/java8/Contents/Home 
SBT_OPTS= -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF-8 
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins 
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins... 
[info] Resolving org.fusesource.jansi#jansi;1.4 ... 
[info] Done updating. 
[info] Set current project to clear-library-dependencies (in build file:/Users/jacek/dev/sandbox/clear-library-dependencies/) 
[clear-library-dependencies]> show libraryDependencies 
[info] List() 
[clear-library-dependencies]> compile 
[info] Updating {file:/Users/jacek/dev/sandbox/clear-library-dependencies/}clear-library-dependencies... 
[info] Resolving org.fusesource.jansi#jansi;1.4 ... 
[info] Done updating. 
[info] Compiling 1 Scala source to /Users/jacek/dev/sandbox/clear-library-dependencies/target/scala-2.10/classes... 
[trace] Stack trace suppressed: run last compile:compileIncremental for the full output. 
[error] (compile:compileIncremental) scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found. 
[error] Total time: 0 s, completed Feb 3, 2015 10:36:08 PM 

Değişim inşa (Kullanılabilir değil, sadece noktayı göstermek için):

[clear-library-dependencies]> reload 
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins 
[info] Set current project to clear-library-dependencies (in build file:/Users/jacek/dev/sandbox/clear-library-dependencies/) 
[clear-library-dependencies]> show libraryDependencies 
[info] List(org.scala-lang:scala-library:2.10.4) 
[clear-library-dependencies]> compile 
[info] Updating {file:/Users/jacek/dev/sandbox/clear-library-dependencies/}clear-library-dependencies... 
[info] Resolving org.fusesource.jansi#jansi;1.4 ... 
[info] Done updating. 
[info] Compiling 1 Scala source to /Users/jacek/dev/sandbox/clear-library-dependencies/target/scala-2.10/classes... 
[success] Total time: 1 s, completed Feb 3, 2015 10:38:19 PM