最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dependency management - Is it possible to define an sbt plugin through an sbt file? - Stack Overflow

programmeradmin0浏览0评论

I have a library which has a semi mandatory requirement of changes to the sbt file of any project depending on it. This involves loading and enabling a third party plugin as well as setting some variables the latter requires. Can I create what is essentially a macro: a way to introduce those changes by a single line, such as/similar to addSbtPlugin("me" % "mylibrary" % "version") (instead of libraryDependencies += "me" % "mylibrary" %% "version")?

I am not a power user of sbt and have no experience with interfacing it programatically; it would most convenient for me to simply define an sbt file containing the instructions which should be inlined in the sbt of a client project. This would also be much more transparent to the authors of client projects, as they could easily understand what is happening.

Failing that, can I somehow achieve auto enabling of my plugin, that is do not require the client project to use enablePlugin(MyPlugin) directive? I would like for the dependency on my library to be introduced by a single line in client projects.

发布评论

评论列表(0)

  1. 暂无评论