@@ -30,6 +30,7 @@ object Dependencies {
3030 val scalatest = " 3.2.9"
3131 val specs2 = " 2.5"
3232 val aws = " 2.17.85"
33+ val jacksonModuleScala = " 2.10.4"
3334
3435 val apacheCommonsLang3 = " 3.12.0"
3536 val commonsConfiguration = " 1.6"
@@ -57,21 +58,44 @@ object Dependencies {
5758 }
5859 }
5960
60- val sparkCore = moduleByScala(" org.apache.spark" %% " spark-core" % _ % Provided )(Versions .spark2, Versions .spark3) _
61- val sparkSql = moduleByScala(" org.apache.spark" %% " spark-sql" % _ % Provided )(Versions .spark2, Versions .spark3) _
61+
62+ // extended version where to moduleId Fn takes 2 params: module version and scala version (to pass along)
63+ def moduleByScalaUsingScalaVersion (moduleIdWithoutVersionNeedsScalaVersion : (String , String ) => ModuleID )
64+ (scala211Version : String , scala212Version : String )
65+ (actualScalaVersion : String ): ModuleID = {
66+ actualScalaVersion match {
67+ case _ if actualScalaVersion.startsWith(" 2.11" ) => moduleIdWithoutVersionNeedsScalaVersion.apply(scala211Version, actualScalaVersion)
68+ case _ if actualScalaVersion.startsWith(" 2.12" ) => moduleIdWithoutVersionNeedsScalaVersion.apply(scala212Version, actualScalaVersion)
69+ case _ => throw new IllegalArgumentException (" Only Scala 2.11 and 2.12 are currently supported." )
70+ }
71+ }
72+
73+
74+ lazy val sparkCore = {
75+ def coreWithExcludes (version : String , scalaVersion : String ): ModuleID = " org.apache.spark" %% " spark-core" % version % Provided exclude(
76+ " com.fasterxml.jackson.core" , " jackson-databind"
77+ ) exclude(
78+ " com.fasterxml.jackson.module" , " jackson-module-scala_" + scalaVersion.substring(0 , 4 ) // e.g. 2.11
79+ )
80+ moduleByScalaUsingScalaVersion(coreWithExcludes)(Versions .spark2, Versions .spark3) _
81+ }
82+
83+ lazy val sparkSql = moduleByScala(" org.apache.spark" %% " spark-sql" % _ % Provided )(Versions .spark2, Versions .spark3) _
6284
6385 lazy val scalaTest = " org.scalatest" %% " scalatest" % Versions .scalatest % Test
6486
65- val json4sExt = moduleByScala(" org.json4s" %% " json4s-ext" % _)(Versions .json4s_spark2, Versions .json4s_spark3) _
66- val json4sCore = moduleByScala(" org.json4s" %% " json4s-core" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3) _
67- val json4sJackson = moduleByScala(" org.json4s" %% " json4s-jackson" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3) _
68- val json4sNative = moduleByScala(" org.json4s" %% " json4s-native" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3)_
87+ lazy val json4sExt = moduleByScala(" org.json4s" %% " json4s-ext" % _)(Versions .json4s_spark2, Versions .json4s_spark3) _
88+ lazy val json4sCore = moduleByScala(" org.json4s" %% " json4s-core" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3) _
89+ lazy val json4sJackson = moduleByScala(" org.json4s" %% " json4s-jackson" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3) _
90+ lazy val json4sNative = moduleByScala(" org.json4s" %% " json4s-native" % _ % Provided )(Versions .json4s_spark2, Versions .json4s_spark3) _
6991
7092 lazy val absaCommons = " za.co.absa.commons" %% " commons" % Versions .absaCommons
7193 lazy val commonsConfiguration = " commons-configuration" % " commons-configuration" % Versions .commonsConfiguration
7294 lazy val apacheCommons = " org.apache.commons" % " commons-lang3" % Versions .apacheCommonsLang3
7395 lazy val typeSafeConfig = " com.typesafe" % " config" % Versions .typesafeConfig
7496
97+ lazy val jacksonModuleScala = " com.fasterxml.jackson.module" %% " jackson-module-scala" % Versions .jacksonModuleScala
98+
7599 lazy val mockitoScala = " org.mockito" %% " mockito-scala" % Versions .mockitoScala % Test
76100 lazy val mockitoScalaScalatest = " org.mockito" %% " mockito-scala-scalatest" % Versions .mockitoScala % Test
77101
@@ -90,7 +114,8 @@ object Dependencies {
90114 def modelDependencies (scalaVersion : String ): Seq [ModuleID ] = Seq (
91115 json4sCore(scalaVersion),
92116 json4sJackson(scalaVersion),
93- json4sNative(scalaVersion)
117+ json4sNative(scalaVersion),
118+ jacksonModuleScala
94119 )
95120
96121 def coreDependencies (scalaVersion : String ): Seq [ModuleID ] = Seq (
0 commit comments