简体   繁体   中英

How to split build.sbt in a Play Framework Project?

I am not sure how to split the build.sbt file in a Play project. Usually in the Play projects I have seen only one build.sbt file, but the project I am referring to have multiple build files in addition to the build.sbt file like:

  1. build.checkstyle.sbt
  2. build.findbugs.sbt
  3. build.junit.sbt

I am not sure if they have split the build.sbt file or is it something else all together. Can anybody help me understand what is happening here?

One more thing is I know what are the purpose of these files like the file is used for code style checking and the file is for the unit testing. 文件用于代码样式检查, 文件用于单元测试。 These functions are working perfectly fine, but what I am struggling to understand is how/where did they configure it. I mean these files are not imported by the base build.sbt file so how is the configuration done?

This is just how sbt works. It scans your project for .sbt files, not only a build.sbt file. From sbt docs :

Any time files ending in .scala or .sbt are used, naming them build.sbt and Build.scala are conventions only. This also means that multiple files are allowed.

So, basically, at the mentioned project, people decided that it would be better to split the settings in different files. There is nothing special to do and sbt will handle that for you. Another example is Playframework itself:

https://github.com/playframework/playframework/tree/master/framework

See how it have a build.sbt and a version.sbt files. This is also just a convention so that you can configure the project version at a separated file (which is understood by some sbt plugins, like sbt-release).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM