Skip to content

Instantly share code, notes, and snippets.

@bossiernesto
Forked from tjayr/compiler_mirror_error
Created November 6, 2013 20:07
Show Gist options
  • Select an option

  • Save bossiernesto/7343221 to your computer and use it in GitHub Desktop.

Select an option

Save bossiernesto/7343221 to your computer and use it in GitHub Desktop.
I came across this problem while trying to add the Datastax Cassandra driver
as a Maven dependency to a Scala project.
After adding the dependency to the pom, Scala IDE (3.0.1) complains with this
error yes/no confirmation box.
Add Scala library to project classpath? There was an error initializing the
Scala compiler: could not find a required class: object scala.runtime in
compiler mirror. No/Yes
My life is a constant battle of mistrust with IDE environments, so when in
doubt head for the command line:
mvn clean install
produced a failed build with the same error:
error: error while loading <root>, error in opening zip file [ERROR] error:
scala.reflect.internal.MissingRequirementError: object scala.runtime in
compiler mirror not found.
Initially I thought the problem was with either the Datastax dependency or
Scala/Scala IDE, but after a bit of googling
(ref: https://groups.google.com/forum/#!msg/scala-user/A-aejw44XGs/QomJ5_Chd0sJ),
it turns out its not directly related to either of them. The problem is actually
a corrupt jar somewhere in the Maven repository.
The solution:
1. The quickest and most invasive solution is empty your Maven repository
and rebuild, to have it download everything fresh.
2. For a bit more precision, particularly if you have a large Maven repo,
run
mvn dependency:tree
on the project you're adding the new dependency to. Then pick out the
transitive dependencies and only remove these from your repository.
Rebuild your project and Maven should sort itself out.
mvn dependency:tree
tony@tony-pc:~/git-projects/snippets/parser-3gpp$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building parser-3gpp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ parser-3gpp ---
[INFO] com.clearprecision:parser-3gpp:jar:0.0.1-SNAPSHOT
[INFO] +- com.clearprecision:parser-api:jar:0.0.1-SNAPSHOT:compile
[INFO] +- com.datastax.cassandra:cassandra-driver-core:jar:1.0.0:compile
[INFO] | +- io.netty:netty:jar:3.6.3.Final:compile
[INFO] | +- com.google.guava:guava:jar:14.0.1:compile
[INFO] | +- org.apache.cassandra:cassandra-thrift:jar:1.2.3:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.5:compile (version managed from 1.7.2)
[INFO] | +- org.apache.thrift:libthrift:jar:0.7.0:compile
[INFO] | | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | | \- org.apache.httpcomponents:httpclient:jar:4.0.1:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | \- org.apache.cassandra:cassandra-all:jar:1.2.3:compile
[INFO] | +- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] | +- net.jpountz.lz4:lz4:jar:1.1.0:compile
[INFO] | +- com.ning:compress-lzf:jar:0.8.4:compile
[INFO] | +- commons-cli:commons-cli:jar:1.1:compile
[INFO] | +- commons-codec:commons-codec:jar:1.2:compile
[INFO] | +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.3:compile
[INFO] | +- org.antlr:antlr:jar:3.2:compile
[INFO] | | \- org.antlr:antlr-runtime:jar:3.2:compile
[INFO] | | \- org.antlr:stringtemplate:jar:3.2:compile
[INFO] | | \- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.apache.cassandra.deps:avro:jar:1.4.0-cassandra-1:compile
[INFO] | | \- org.mortbay.jetty:jetty:jar:6.1.22:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.22:compile
[INFO] | | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
[INFO] | +- jline:jline:jar:1.0:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1:compile
[INFO] | +- com.github.stephenc.high-scale-lib:high-scale-lib:jar:1.1.2:compile
[INFO] | +- org.yaml:snakeyaml:jar:1.6:compile
[INFO] | +- edu.stanford.ppl:snaptree:jar:0.1:compile
[INFO] | +- org.mindrot:jbcrypt:jar:0.3m:compile
[INFO] | +- log4j:log4j:jar:1.2.16:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.2:runtime
[INFO] | \- com.github.stephenc:jamm:jar:0.2.5:compile
[INFO] +- org.scala-lang:scala-library:jar:2.10.2:compile
[INFO] +- junit:junit:jar:4.10:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- com.typesafe.akka:akka-actor_2.10:jar:2.2.1:compile
[INFO] | \- com.typesafe:config:jar:1.0.2:compile
[INFO] +- com.typesafe.akka:akka-testkit_2.10:jar:2.2.1:test
[INFO] \- org.scalatest:scalatest_2.10:jar:1.9.1:test
[INFO] +- org.scala-lang:scala-actors:jar:2.10.0:test
[INFO] \- org.scala-lang:scala-reflect:jar:2.10.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.796s
[INFO] Finished at: Thu Sep 19 13:10:00 IST 2013
[INFO] Final Memory: 11M/159M
[INFO] ------------------------------------------------------------------------
cd ~/.m2/repository
tony@tony-pc:~/.m2/repository$ rm -rf com/datastax/cassandra/cassandra-driver-core
tony@tony-pc:~/.m2/repository$ rm -rf io/netty/netty
tony@tony-pc:~/.m2/repository$ rm -rf com/google/guava/guava
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/cassandra/cassandra-thrift
tony@tony-pc:~/.m2/repository$ rm -rf commons-lang/commons-lang
tony@tony-pc:~/.m2/repository$ rm -rf org/slf4j/slf4j-api
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/thrift/libthrift
tony@tony-pc:~/.m2/repository$ rm -rf javax/servlet/servlet-api
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/httpcomponents/httpclient
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/httpcomponents/httpcore
tony@tony-pc:~/.m2/repository$ rm -rf commons-logging/commons-logging
tony@tony-pc:~/.m2/repository$ rm -rf org/codehaus/jackson/jackson-core-asl
tony@tony-pc:~/.m2/repository$ rm -rf com/yammer/metrics/metrics-core
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/cassandra/cassandra-all
tony@tony-pc:~/.m2/repository$ rm -rf org/xerial/snappy/snappy-java
tony@tony-pc:~/.m2/repository$ rm -rf net/jpountz/lz4/lz4
tony@tony-pc:~/.m2/repository$ rm -rf com/ning/compress-lzf
tony@tony-pc:~/.m2/repository$ rm -rf commons-cli/commons-cli
tony@tony-pc:~/.m2/repository$ rm -rf commons-codec/commons-codec
tony@tony-pc:~/.m2/repository$ rm -rf com/googlecode/concurrentlinkedhashmap/concurrentlinkedhashmap-lru
tony@tony-pc:~/.m2/repository$ rm -rf org/antlr/antlr
tony@tony-pc:~/.m2/repository$ rm -rf org/antlr/antlr-runtime
tony@tony-pc:~/.m2/repository$ rm -rf org/antlr/stringtemplate
tony@tony-pc:~/.m2/repository$ rm -rf antlr/antlr
tony@tony-pc:~/.m2/repository$ rm -rf org/apache/cassandra/deps/avro
tony@tony-pc:~/.m2/repository$ rm -rf org/mortbay/jetty/jetty
tony@tony-pc:~/.m2/repository$ rm -rf org/mortbay/jetty/jetty-util
tony@tony-pc:~/.m2/repository$ rm -rf org/mortbay/jetty/servlet-api
tony@tony-pc:~/.m2/repository$ rm -rf org/codehaus/jackson/jackson-mapper-asl
tony@tony-pc:~/.m2/repository$ rm -rf jline/jline
tony@tony-pc:~/.m2/repository$ rm -rf com/googlecode/json-simple/json-simple
tony@tony-pc:~/.m2/repository$ rm -rf com/github/stephenc/high-scale-lib/high-scale-lib
tony@tony-pc:~/.m2/repository$ rm -rf org/yaml/snakeyaml
tony@tony-pc:~/.m2/repository$ rm -rf edu/stanford/ppl/snaptree
tony@tony-pc:~/.m2/repository$ rm -rf org/mindrot/jbcrypt
tony@tony-pc:~/.m2/repository$ rm -rf log4j/log4j
tony@tony-pc:~/.m2/repository$ rm -rf org/slf4j/slf4j-log4j12
tony@tony-pc:~/.m2/repository$ rm -rf com/github/stephenc/jamm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment