从外壳运行“ sbt show subproject / dependencyClasspathAsJars”

时间:2019-11-05 09:05:56

标签: scala sbt

在我的多项目构建中,我可以列出一个子项目的所有依赖项:

$ 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。

1 个答案:

答案 0 :(得分:0)

show dependencyClasspathAsJars需要作为单个参数传递给sbt 。对于普通的外壳,这可以起作用:

$ sbt "project subproject2" "show dependencyClasspathAsJars"

project subproject2选择您的子项目,show dependencyClasspathAsJars计算子项目的任务。