如何在多模块构建中禁用根聚合模块的打包和发布任务? [英] How to disable package and publish tasks for root aggregate module in multi-module build?

查看:28
本文介绍了如何在多模块构建中禁用根聚合模块的打包和发布任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多项目 SBT 项目,它看起来像 SBT 文档中的示例:

I have a multiproject SBT project, which looks like the example on SBT doc:

import sbt._
import Keys._

object HelloBuild extends Build {
  lazy val root = Project(id = "hello",
                        base = file(".")) aggregate(foo, bar)

  lazy val foo = Project(id = "hello-foo",
                       base = file("foo"))

  lazy val bar = Project(id = "hello-bar",
                       base = file("bar"))
}

因为 root 只是一个聚合两个子项目的虚拟项目,我想避免包生成(和工件发布),但仍然为两个子项目生成包(和发布).

Because root is just a virtual project to aggregate both subprojects, I would like to avoid package generation (and artifact publication), but still generate package (and publish) for both subprojects.

有没有简单的方法来实现它?

Is there an easy way to achieve it ?

推荐答案

实际上, 非常简单.只需覆盖根项目中 publish 的设置:

Actually, it is pretty easy. Just override the setting for publish in the root project:

base = file(".")) settings (publish := { }) aggregate(foo, bar)

这篇关于如何在多模块构建中禁用根聚合模块的打包和发布任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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