运行时的sbt开关依赖项 [英] sbt switch dependencies for runtime
问题描述
我正在开发使用xgboost4j的spark应用程序. https://github.com/dmlc/xgboost/tree/master/jvm-包
I am developing a spark application which is using xgboost4j. https://github.com/dmlc/xgboost/tree/master/jvm-packages
由于jar的本地C依赖性,需要将该程序包编译为本地体系结构.但是群集的架构与开发笔记本电脑不同.通过集群中的一个运行sbt程序集时,如何替换该程序包?还是建议您通过%提供"来解决此问题?
This package requires to be compiled to the local architecture due to local C dependencies of the jar. But the cluster has a different architecture than the development laptop. How can I substitute the package when running sbt assembly via one from the cluster? Or would you suggest to solve this via a % "provided" ?
推荐答案
为(提供/编译)的lib使用后缀,如下所示:
Use suffix for (provided/compile) libs as like:
val suffix = Option(System getProperty "provided").isDefined match {
case true => "provided"
case false => "compile"
}
libraryDependencies += "org.apache.spark" %% "spark-sql" % Spark.version % suffix
如果需要在uberjar中放置所有jar,请运行sbt -Dprovided assembly
and run sbt -Dprovided assembly
if you need all jars in your uberjar
这篇关于运行时的sbt开关依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!