fix for building on java 11 and above
parent
54c84e7ca7
commit
fcd9c7bf64
27
build.sc
27
build.sc
|
@ -111,6 +111,33 @@ object astral extends Module
|
|||
def ivyDeps = Agg(
|
||||
ivy"org.apache.spark::spark-sql::3.4.1",
|
||||
)
|
||||
|
||||
def internalJavaVersion = T {
|
||||
try {
|
||||
val jvm = System.getProperties().getProperty("java.version")
|
||||
println(f"Running Vizier with `${jvm}`")
|
||||
jvm.split("\\.")(0).toInt
|
||||
} catch {
|
||||
case _:NumberFormatException | _:ArrayIndexOutOfBoundsException =>
|
||||
println("Unable to retrieve java version. Guessing 11+")
|
||||
11
|
||||
}
|
||||
}
|
||||
|
||||
def forkArgs = T {
|
||||
if(internalJavaVersion() >= 11){
|
||||
Seq(
|
||||
// Required on Java 11+ for Arrow compatibility
|
||||
// per: https://spark.apache.org/docs/latest/index.html
|
||||
"-Dio.netty.tryReflectionSetAccessible=true",
|
||||
|
||||
// Required for Spark on java 11+
|
||||
// per: https://stackoverflow.com/questions/72230174/java-17-solution-for-spark-java-lang-noclassdeffounderror-could-not-initializ
|
||||
"--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
)
|
||||
} else { Seq[String]() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue