scala - 从 shell 运行“sbt show subproject/dependencyClasspathAsJars”
问题描述
在我的多项目构建中,我可以列出我的一个子项目的所有依赖项:
$ sbt
[info] ...
sbt:MyProject> show subproject2/dependencyClasspathAsJars
/path/jar1:/path/jar2:...:/home/.../MyProject/build/subproject1.jar
sbt:MyProject>
但是,我需要在 CI 中运行它,但是......:
$ sbt show subproject2/dependencyClasspathAsJars
[info] Loading global plugins from /home/.../plugins
[info] Loading project definition from /home/.../MyProject/project
[info] Loading settings for project MyProject from build.sbt,modules.sbt ...
[info] Set current project to MyProject (in build file:/home/.../MyProject/)
[error] Not a valid command: show (similar: shell)
[error] Expected whitespace character
[error] Not a valid project ID: show
[error] Expected ':'
[error] Not a valid key: show (similar: showTiming, sLog, ps)
[error] show
[error] ^
要从(shell)命令行获取这个类路径,我应该怎么做?我正在使用 sbt 1.2.8 和 scala 2.10。
解决方案
show dependencyClasspathAsJars
需要作为单个参数传递给 sbt 。使用常见的外壳,这有效:
$ sbt "project subproject2" "show dependencyClasspathAsJars"
project subproject2
选择您的子项目并show dependencyClasspathAsJars
计算子项目上的任务。
推荐阅读
- string - powershell 获取 C 盘的 shadowstorage maxspace 作为字符串
- javascript - 计算 2 个期权价值的总和
- selenium-webdriver - 搜索框的网站 Flipkart.com 上此代码的 xpath 是什么
- javascript - JS代码中构造函数或类的正确放置是什么?
- git - 如何从远程存储库更新远程和本地分支?
- rest - 谁可以修复关于球衣 hk2 SystemInjecteeImpl 的 MultiException
- javascript - 如何重构此 node.js 代码,以避免重复
- python - 从命令行检查结果时使用 if 语句
- c++ - 使用 libevent 监控 Raspberry Pi GPIO 引脚变化
- java - 从内部存储的特定文件夹中读取字符串