我克隆了sbt源代码,试图研究它,但找不到
def main
或
extends App
即使在sbt\main\src\main\scala\sbt\main.scala 中
我搜索了所有的源文件,发现一些文件有主要的方法,但所有这些文件都在测试中,我认为这些方法是sbt 的主要方法
那么sbt的主要方法在哪里呢?谢谢
如何在基于*nix的系统上快速找到它
查找启动sbt
的java进程的pid
ps aux | grep java
0:35.42 /usr/bin/java -Xms512m -Xmx3g -Xss2m -jar /.sbt/launchers/1.3.3/sbt-launch.jar shell
这告诉您主类位于sbt-launch.jar
jar文件中
向JVM发送信号3或使用jstack获取JVM 的线程转储
kill -3 xxxx
这里是
at sbt.xMain.run(Main.scala:39)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:130)
at xsbt.boot.Launch$.run(Launch.scala:111)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
at xsbt.boot.Launch$.launch(Launch.scala:119)
at xsbt.boot.Launch$.apply(Launch.scala:20)
at xsbt.boot.Boot$.runImpl(Boot.scala:56)
at xsbt.boot.Boot$.main(Boot.scala:18)
at xsbt.boot.Boot.main(Boot.scala)
我认为这最终是sbt启动器中的主要方法
https://github.com/sbt/launcher/blob/1.x/launcher-implementation/src/main/scala/xsbt/boot/Boot.scala
来自主
/** This class is the entry point for sbt. */
final class xMain extends xsbti.AppMain {
...
}
您可以看到它是如何从启动器项目扩展AppMain的。不过,我不确定这其中包含了什么魔力。