sbt-仅在发布期间排除某些依赖项 [英] sbt - exclude certain dependency only during publish

查看:181
本文介绍了sbt-仅在发布期间排除某些依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个实用程序库,该实用程序库可以与Apache Spark的1.0、1.1、1.2版本之一一起使用.

I'm building a utility library that can be used together with one of 1.0, 1.1, 1.2 version of Apache Spark.

由于它们都是二进制向后兼容的,所以我想让用户决定要使用哪个spark版本(通过手动将spark-core和首选版本作为依赖项与我的库一起添加),并且不要强加任何库的POM中的版本限制.否则,它会因依赖项驱逐警告而使用户烦恼.

Since they are all binary backwards-compatible, I'd like to let the user decide which spark version to use (by manually adding spark-core with preferred version as a dependency along with my library), and do not impose any version restriction in the library's POM. Otherwise it will annoy users with dependency eviction warnings.

是否可以在不更改任何编译行为的情况下使sbt忽略已发布的POM中的库依赖项?

Is it possible to make sbt omit a library dependency in the published POM while not changing any compilation behaviour?

推荐答案

是的,provided配置是专门为此设计的:

Yes, the provided configuration is specifically designed for that:

libraryDependencies += "org" %% "artifact" % "1.0" % "provided"

将在编译过程中将所述库放在类路径中,而不放在POM文件中.

will put said library on the classpath during compilation, but not in the POM file.

这篇关于sbt-仅在发布期间排除某些依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆