I would like to compile a project with Scala 2.10 and 2.11 using the sbt cross compile feature. The problem is that this project contains some Flink dependencies. But the Flink jars do not follow the standard binary format (postfixing the name with _2.10
or _2.11
): The scala 2.10 jars do not have a postfix and the 2.11 have it.
I found a working solution. But I'm not happy with it and my question is: is there an easier and/or more elegant way to solve this problem?
My current solution:
def flinkDependencies(scalaVersion: String) = {
if (scalaVersion.startsWith("2.10"))
Seq(
"org.apache.flink" % "flink-scala" % flinkVersion % "optional",
"org.apache.flink" % "flink-streaming-scala" % flinkVersion % "optional"
)
else
Seq(
"org.apache.flink" %% "flink-scala" % flinkVersion % "optional",
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "optional"
)
}
libraryDependencies <++= scalaVersion(flinkDependencies)