56

sbt在空目录中运行命令时,它一直失败,并出现以下异常:

$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
Error wrapping InputStream in GZIPInputStream: java.io.EOFException
    at sbt.ErrorHandling$.translate(ErrorHandling.scala:11)
    at sbt.WrapUsing.open(Using.scala:36)
    at sbt.Using.apply(Using.scala:24)
    at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:778)
    at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:777)
    at sbt.Using.apply(Using.scala:25)
    at sbt.IO$.gzipFileIn(IO.scala:777)
    at sbt.Sync$.readUncaught(Sync.scala:88)
    at sbt.Sync$.readInfo(Sync.scala:84)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:29)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:23)
    at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:770)
    at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:766)
    at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:35)
    at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    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.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.EOFException
    at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:264)
    at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:254)
    at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:163)
    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:78)
    at sbt.Using$$anonfun$gzipInputStream$1.apply(Using.scala:91)
    at sbt.Using$$anonfun$gzipInputStream$1.apply(Using.scala:91)
    at sbt.Using$$anon$1.openImpl(Using.scala:56)
    at sbt.WrapUsing$$anonfun$open$2.apply(Using.scala:36)
    at sbt.ErrorHandling$.translate(ErrorHandling.scala:11)
    at sbt.WrapUsing.open(Using.scala:36)
    at sbt.Using.apply(Using.scala:24)
    at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:778)
    at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:777)
    at sbt.Using.apply(Using.scala:25)
    at sbt.IO$.gzipFileIn(IO.scala:777)
    at sbt.Sync$.readUncaught(Sync.scala:88)
    at sbt.Sync$.readInfo(Sync.scala:84)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:29)
    at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:23)
    at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:770)
    at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:766)
    at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:35)
    at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    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.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
[error] (compile:copyResources) Error wrapping InputStream in GZIPInputStream: java.io.EOFException
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

问题的根本原因是什么?

4

4 回答 4

115

似乎异常是由于本地存储库的一些问题造成的。清理后,例如target从目录中删除目录,~/.sbt它现在工作正常。

jacek:~/.sbt
$ find . -name target | xargs rm -rf

jacek:~/sandbox/stackoverflow/testaaa
$ sbt
[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 testaaa (in build file:/Users/jacek/sandbox/stackoverflow/testaaa/)
[testaaa]>

我在 play-framework 论坛中的线程[2.1.1] SBT: InputStream in GZIPInputStream: java.io.EOFException中找到了解决方案。


我还被告知,在删除target项目主目录中的所有目录(例如target.project/target

jacek:my-project-path
$ find . -name target | xargs rm -rf
于 2013-12-03T21:29:03.003 回答
8

进入项目目录

$ cd my-spark-app
$ rm -rf target
$ cd project 
$ rm -rf target project

现在开始 sbt

$sbt 
于 2017-09-03T18:40:16.677 回答
1

您可以sbt clean在您的目录上运行(以删除之前可能已创建的target文件),然后尝试运行. 尝试通过运行创建 Akka HTTP 种子项目时遇到此问题。我的错误是运行命令时我不在一个空目录中。可以在此处找到有关该错误的更多信息/srcsbtsbt -Dsbt.version=0.13.15 new https://github.com/akka/akka-http-scala-seed.g8

于 2017-10-16T16:59:17.150 回答
0

步骤 1:您需要在 .bash_profile 中添加 sbt 路径,以防 windows 需要添加环境变量,然后转到终端并运行 ./sbt 文件。

第 2 步:从项目目录中删除目标文件夹。

第 3 步:从 intellijID 终端“sbt clean”运行 sbt 命令,然后运行“activator clean”,然后运行 ​​activator update”。

于 2017-04-12T12:16:01.840 回答