How should one start on creating a sbt plugin?

I want to create a sbt plugin for Scala project.

Please any one suggest me how we start?

I referred Plugins documentation but unable to understand steps.


The first step in becoming a sbt plugin author is understanding sbt build definition. The best resource for it is Getting Started guide. For plugins, it's essential that you understand the concept of scoping. Some of my blog posts like an unofficial guide to sbt 0.10 v2.0 and traveling through the 4th dimension with sbt 0.13 discuss the topic.

Next, try reading the source code for existing plugins:

  • sbt/sbt-appengine

  • sbt-appengine adds defines appengineSettings , which the build user can include in his or her build definition to add appengineDeploy and other appengine related tasks.
  • sbt/sbt-man

  • sbt-man on the other hand overrides settings and adds man command.
  • These are roughly two patterns for plugins. Once you understand them fully, try making your own plugin.

    Another source of inspiration is the source for sbt itself. Whenever I'm writing a plugin, I'd consult Defaults.scala to see how sbt implements a particular task that I'm interested in. Once you're comfortable, you should also read Plugins Best Practices too.

    链接地址: http://www.djcxy.com/p/69128.html

    上一篇: 使用NSArray对象的NSUserDefaults NSObject

    下一篇: 应该如何开始创建一个sbt插件?