如何在SBT任务中获得所有项目?

时间:2023-01-31 22:54:36

I'm writing a SBT task, which will get all projects of the whole project, then I can run some tasks against them.

我正在写一个SBT任务,它将获得整个项目的所有项目,然后我可以针对它们运行一些任务。

The pseudo code is like:

伪代码如下:

val projects = someTaskToGetProjects.value
val updateReports = projects.map(p => (update in p).value)

But I can't find any task or setting to get the project list, how to do it?

但我找不到任何任务或设置来获取项目列表,该怎么做?

1 个解决方案

#1


I think buildDependencies might suit your needs, otherwise loadedBuild has everything.

我认为buildDependencies可能适合您的需求,否则loadedBuild会拥有一切。

val projects = buildDependencies.value.classpath.keys
val updateReports = projects.map(p => (update in p).value)

#1


I think buildDependencies might suit your needs, otherwise loadedBuild has everything.

我认为buildDependencies可能适合您的需求,否则loadedBuild会拥有一切。

val projects = buildDependencies.value.classpath.keys
val updateReports = projects.map(p => (update in p).value)