RootProject 和 ProjectRef [英] RootProject and ProjectRef

查看:40
本文介绍了RootProject 和 ProjectRef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图找到有关 RootProject 和 ProjectRef 的更多信息,但看起来在 sbt 文档中根本没有提及.

I have been trying to find more information on RootProject and ProjectRef, but looks like it is not mentioned at all in sbt documentation.

我了解,如果您要引用根项目,则在引用子项目时应该使用 RootProject 和 ProjectRef.但是,尚不清楚它们之间的行为有何不同.有人可以帮忙解释一下吗?

I understand that if you are referencing a root project you should use RootProject and ProjectRef when you are referencing a sub-project. However it is not clear how the behavior will be different between them. Can somebody please help explain?

还有它没有记录的事实,是否意味着 RootProject 和 ProjectRef 不是引用其他 sbt 项目的推荐方式?

Also the fact that it is not documented, does it mean that RootProject and ProjectRef are not the recommended way to reference other sbt projects?

谢谢.

推荐答案

单个 sbt 构建有一个 project/ 目录,用于 .scala 构建定义和插件定义.该构建中可以有多个子项目,它们具有自己的 .sbt 文件,但不是它们自己的 project/*.scala 文件.

A single sbt build has a single project/ directory for .scala build definitions and plugin definitions. There can be multiple subprojects within that build with their own .sbt files, but not their own project/*.scala files.

当您想直接包含其他单独的构建而不是使用它们发布的二进制文件时,您可以使用源依赖项".这是RootProjectProjectRef 声明的内容.ProjectRef 是最通用的:您指定构建的位置(一个 URI)和您想要依赖的构建中项目的 ID(一个字符串).RootProject 很方便,它可以在您指定的 URI 处为构建选择根项目.

When you want to include other, separate builds directly instead of using their published binaries, you use "source dependencies". This is what RootProject and ProjectRef declare. ProjectRef is the most general: you specify the location of the build (a URI) and the ID of the project in the build (a String) that you want to depend on. RootProject is a convenience that selects the root project for the build at the URI you specify.

源依赖确实有开销:启动时间、内存使用和命令行可用性.如果项目组不需要分开,最好使用带有标准子项目的单个构建.

Source dependencies do have an overhead: startup time, memory usage, and command line usability. If the group of projects don't need to be separate, it is best to use a single build with standard subprojects.

这篇关于RootProject 和 ProjectRef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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