Skip to content

Commit 7dd9f28

Browse files
committed
Enforce Guava 18 by dependencyOverrides.
This is required for EmbeddedCassandra based on 3.11. New DSE libraries are coming with Guava 31 which takes precedence causing runtime problems in the EmbeddedCassandra used for the test.
1 parent 05120a9 commit 7dd9f28

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

scala/sbt/dse/build.sbt

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
21
name := "writeRead"
3-
42
version := "0.1"
5-
63
scalaVersion := "2.11.8"
74

85
resolvers += Resolver.mavenLocal // for testing
96
resolvers += "DataStax Repo" at "https://repo.datastax.com/public-repos/"
107

11-
val dseVersion = "6.8.1"
12-
138
// Please make sure that following DSE version matches your DSE cluster version.
149
// Exclusions are solely for running integrated testing
1510
// Warning Sbt 0.13.13 or greater is required due to a bug with dependency resolution
11+
val dseVersion = "6.8.1"
12+
1613
libraryDependencies += "com.datastax.dse" % "dse-spark-dependencies" % dseVersion % "provided" exclude(
1714
"org.slf4j", "log4j-over-slf4j")
1815

1916
// Test Dependencies
2017
// The 'test/resources' Directory in should match the resources directory in the `it` directory
2118
// for the version of the Spark Cassandra Connector in use.
22-
val scalaTestVersion = "3.0.0"
2319
val connectorVersion = "2.0.10"
24-
val jUnitVersion = "4.12"
2520
val cassandraVersion = "3.11.10"
2621
val guavaVersion = "18.0" // required for EmbeddedCassandra based on Cassandra 3.11.x
22+
val scalaTestVersion = "3.0.0"
23+
val jUnitVersion = "4.12"
2724

2825
libraryDependencies ++= Seq(
29-
"com.datastax.spark" %% "spark-cassandra-connector-embedded" % connectorVersion % "test" exclude(
30-
"com.datastax.cassandra", "*"),
26+
"com.datastax.spark" %% "spark-cassandra-connector-embedded" % connectorVersion % "test"
27+
exclude("com.datastax.cassandra", "*"),
3128
"org.apache.cassandra" % "cassandra-all" % cassandraVersion % "test",
3229
"org.scalatest" %% "scalatest" % scalaTestVersion % "test",
33-
"junit" % "junit" % "4.12" % "test",
34-
"com.google.guava" % "guava" % guavaVersion % "test"
30+
"junit" % "junit" % jUnitVersion % "test"
3531
).map(_.excludeAll(
3632
ExclusionRule("org.slf4j","log4j-over-slf4j"),
3733
ExclusionRule("org.slf4j","slf4j-log4j12"))
3834
) // Excluded to allow for Cassandra to run embedded
3935

40-
//Forking is required for the Embedded Cassandra
36+
// Need to enforce certain guava version to run embedded cassandra in test
37+
dependencyOverrides += "com.google.guava" % "guava" % guavaVersion % "test"
38+
39+
// Forking is required for the Embedded Cassandra
4140
javaOptions in Test += s"-Dtest.cassandra.version=$cassandraVersion"
4241
fork in Test := true
4342

44-
//Your dependencies
45-
//libraryDependencies += "org.apache.commons" % "commons-math3" % "3.6.1"
46-
//libraryDependencies += "org.apache.commons" % "commons-csv" % "1.0"
43+
// Your dependencies
44+
// libraryDependencies += "org.apache.commons" % "commons-math3" % "3.6.1"
45+
// libraryDependencies += "org.apache.commons" % "commons-csv" % "1.0"
4746

4847
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
49-
//assemblyShadeRules in assembly := Seq(
50-
// ShadeRule.rename("org.apache.commons.csv.**" -> "shaded.org.apache.commons.csv.@1").inAll
51-
//)
48+
// assemblyShadeRules in assembly := Seq(
49+
// ShadeRule.rename("org.apache.commons.csv.**" -> "shaded.org.apache.commons.csv.@1").inAll
50+
// )

scala/sbt/oss/build.sbt

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
name := "writeRead"
2-
32
version := "0.1"
4-
53
scalaVersion := "2.11.8"
64

7-
val sparkVersion = "2.2.2"
8-
val connectorVersion = "2.0.10"
95
//The 'test/resources' Directory in should match the resources directory in the `it` directory
106
//for the version of the Spark Cassandra Connector in use.
7+
val sparkVersion = "2.2.2"
118

12-
9+
val connectorVersion = "2.0.10"
1310
val cassandraVersion = "3.11.10"
1411
val scalaTestVersion = "3.0.0"
1512
val jUnitVersion = "4.12"
1613

17-
1814
// Please make sure that following dependencies have versions corresponding to the ones in your cluster.
1915
// Note that spark-cassandra-connector should be provided with '--packages' flag to spark-submit command.
2016
libraryDependencies ++= Seq(
@@ -31,14 +27,15 @@ libraryDependencies ++= Seq(
3127
"junit" % "junit" % jUnitVersion % "test"
3228
).map(_.exclude("org.slf4j", "log4j-over-slf4j")) // Excluded to allow for Cassandra to run embedded
3329

34-
//Forking is required for the Embedded Cassandra
30+
// Forking is required for the Embedded Cassandra
31+
javaOptions in Test += s"-Dtest.cassandra.version=$cassandraVersion"
3532
fork in Test := true
3633

37-
//Your dependencies
38-
//libraryDependencies += "org.apache.commons" % "commons-math3" % "3.6.1"
39-
//libraryDependencies += "org.apache.commons" % "commons-csv" % "1.0"
34+
// Your dependencies
35+
// libraryDependencies += "org.apache.commons" % "commons-math3" % "3.6.1"
36+
// libraryDependencies += "org.apache.commons" % "commons-csv" % "1.0"
4037

4138
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
42-
//assemblyShadeRules in assembly := Seq(
43-
// ShadeRule.rename("org.apache.commons.csv.**" -> "shaded.org.apache.commons.csv.@1").inAll
44-
//)
39+
// assemblyShadeRules in assembly := Seq(
40+
// ShadeRule.rename("org.apache.commons.csv.**" -> "shaded.org.apache.commons.csv.@1").inAll
41+
// )

0 commit comments

Comments
 (0)