如何显示用于运行任务的类路径? [英] How to display classpath used for run task?

查看:31
本文介绍了如何显示用于运行任务的类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SBT 0.13下如何显示run任务使用的classpath?

How can the classpath used for run task be displayed under SBT 0.13?

我在这里找到了一些信息https://groups.google.com/forum/#!msg/simple-build-tool/0rhVRPnjyZU/DOYAd14gh1wJ:

I have found some info here https://groups.google.com/forum/#!msg/simple-build-tool/0rhVRPnjyZU/DOYAd14gh1wJ:

我最近正在转储我的类路径,作为对我的构建进行故障排除的一种方式,也许这项任务也可以帮助您:

I was dumping my classpaths as a way to troubleshoot my build recently and maybe this task can help you too:

lazy val printClasspath = task {
  this.runClasspath.getPaths.foreach(println);
  None
}

runClasspath 是一个 PathFinder [1] 实例,您可以进一步查询它.我想构建一个以 ':' 分隔的这些路径列表会很容易.

runClasspath is a PathFinder [1] instance and you can interrogate it even further. I guess building a ':'-separated list of those paths will be easy.

我不明白应该在何处以及如何使用此提示.请指教.

I don't understand where and how I should use this tip. Please advise.

推荐答案

在 build.sbt 文件中添加行 lazy val printClasspath ....

Add the line lazy val printClasspath ... in your build.sbt file.

然后在命令行运行:

sbt printClasspath

这篇关于如何显示用于运行任务的类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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