Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala SBT / Maven2 Error on OSX: "Error Opening Zip File" -> MissingRequirementError

I have a project that builds well on Unix boxes (http://www.github.com/jhclark/ducttape).

However, using SBT 0.11.2 (and a few other versions of SBT), it will not build on my Mac (OSX 10.5). I get the following cryptic error message:

$ ~/bin/sbt compile                                       (master*? 20:11)
[info] Loading project definition from /Users/jon/Documents/workspace-    scala/ducttape/project
[info] Set current project to ducttape (in build file:/Users/jon/Documents/workspace-scala/ducttape/)
[info] Compiling 104 Scala sources to /Users/jon/Documents/workspace-scala/ducttape/target/scala-2.9.2/classes...
[error] error while loading <root>, error in opening zip file
[error] {file:/Users/jon/Documents/workspace-scala/ducttape/}default-024416/compile:compile: scala.tools.nsc.MissingRequirementError: object scala not found.
[error] Total time: 2 s, completed May 27, 2012 8:12:09 PM

This happens even after I clean things out thoroughly with:

sbt clean clean-files
rm -rf ~/.ivy2 ~/.m2 ~/.sbt

I suspect that the real error is happening in Maven2, which SBT uses for dependency management (see also Maven : error in opening zip file when running maven).

However, I'm stumped after several days. Any ideas?

like image 591
jhclark Avatar asked May 28 '12 00:05

jhclark


2 Answers

For completion, I had the same problem and it was a corrupt zip/jar file.

However, Dave's command line checks for the usual classpath directories, where your jar may be.

The one causing me troubles was in fact in my projects ./lib folder. I struggled with this for hours, hopefully this may help someone else.

PS: Thanks a lot Dave!

like image 21
Pablo Fernandez Avatar answered Nov 15 '22 04:11

Pablo Fernandez


I had similar problems when attempting to use an older version of the sbt-extras launcher with sbt-0.11.3. In my case, it attempted to download a file that didn't exist, and attempted to unzip the 404 error page. The most recent sbt-extras launcher has been fixed for sbt-0.11.3.

Yours sounds different, but they may be due to the the shutdown of scala-tools.org. If you can, I recommend upgrading to sbt-0.11.3.

If you need to continue to use 0.11.2, you should use the 0.11.3-2 launcher, put sbt.version=0.11.2 in project/build.properties, and disable the scalaTools repo in your build.sbt. Mark Harrah posted info on the SBT mailing list.

If this doesn't help, for some reason you're downloading corrupted .jars from somewhere.

Run the command find ~/.ivy2 ~/.m2 ~/.sbt -name "*.jar" -exec unzip -qqt {} \; to find which jar(s) are corrupted. The contents of the corrupt jar may give you a clue as to what's going wrong.

like image 119
leedm777 Avatar answered Nov 15 '22 04:11

leedm777