본문 바로가기

Programming Language/Java & Scala

scala개발시 sbt build때 GZIPInputStream: java.util.zip.ZipException: Not in GZIP format 에러나는 경우 해결책


scala를 개발할때 java와 연동되던 gradle이나 maven과는 다른형태의 build툴인 sbt를 사용한다. sbt는 simple build tool 이라는 약자를 가지고 있다고는 하지만 개인적으로 엄청 불편한거같다.


최근 sbt upgrade를 하던도중 아래와 같은 에러를 만났다.


sbt 0.13.X 에서 sbt 1.X로 올리거나 그 반대의 경우 아래와 같은 에러를 만날때가 있다.


에러로그

% sbt
[info] Loading global plugins from /home/smarter/.sbt/0.13/plugins
[info] Updating {file:/home/smarter/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /home/smarter/opt/dotty/project
[info] Updating {file:/home/smarter/opt/dotty/project/}dotty-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
Error wrapping InputStream in GZIPInputStream: java.util.zip.ZipException: Not in GZIP format
        at sbt.ErrorHandling$.translate(ErrorHandling.scala:10)
        at sbt.WrapUsing.open(Using.scala:34)
        at sbt.Using.apply(Using.scala:23)
        at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:863)
        at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:862)
        at sbt.Using.apply(Using.scala:24)
        at sbt.IO$.gzipFileIn(IO.scala:862)
        at sbt.Sync$.readUncaught(Sync.scala:88)
        at sbt.Sync$.readInfo(Sync.scala:84)
        at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:28)
        at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:22)
        at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:948)
        at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:944)
        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:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.zip.ZipException: Not in GZIP format
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)
        at sbt.Using$$anonfun$gzipInputStream$1.apply(Using.scala:84)
        at sbt.Using$$anonfun$gzipInputStream$1.apply(Using.scala:84)
        at sbt.Using$$anon$1.openImpl(Using.scala:51)
        at sbt.WrapUsing$$anonfun$open$2.apply(Using.scala:34)
        at sbt.ErrorHandling$.translate(ErrorHandling.scala:10)
        at sbt.WrapUsing.open(Using.scala:34)
        at sbt.Using.apply(Using.scala:23)
        at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:863)
        at sbt.IO$$anonfun$gzipFileIn$1.apply(IO.scala:862)
        at sbt.Using.apply(Using.scala:24)
        at sbt.IO$.gzipFileIn(IO.scala:862)
        at sbt.Sync$.readUncaught(Sync.scala:88)
        at sbt.Sync$.readInfo(Sync.scala:84)
        at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:28)
        at sbt.Sync$$anonfun$apply$1.apply(Sync.scala:22)
        at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:948)
        at sbt.Defaults$$anonfun$copyResourcesTask$1.apply(Defaults.scala:944)
        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:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[error] (compile:copyResources) Error wrapping InputStream in GZIPInputStream: java.util.zip.ZipException: Not in GZIP format
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?


해결책

개발하던 프로젝트폴더에서 아래 명령어를 실행한다.

cd ${your_project}
rm -fr project/target
rm -fr project/project/target

이미 build되어 output이 있는 target folder에 의해 정상 build가 되지 않는 것으로 보인다.

그러므로 해당 프로젝터의 폴더에 들어가서 target을 모조리 삭제한 후 다시 build하면 정상적으로 진행 된다.


아래와 같이 모조리 지우는 방법도 있다.

cd ${your_project}
find . -name target -exec rm -rf `pwd` \;


Reference