sbt switch dependencies for runtime

怎甘沉沦 提交于 2019-12-22 18:18:39

问题


I am developing a spark application which is using xgboost4j. https://github.com/dmlc/xgboost/tree/master/jvm-packages

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" ?


回答1:


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

and run sbt -Dprovided assembly if you need all jars in your uberjar



来源:https://stackoverflow.com/questions/40782435/sbt-switch-dependencies-for-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!