sbt源代码中的主要方法在哪里?

我克隆了sbt源代码,尝试对其进行研究,但找不到

def main

extends App 

即使在sbt \ main \ src \ main \ scala \ sbt \ Main.scala中

我搜索了所有源文件,发现某些文件具有主要方法,但是所有这些文件都在测试程序中,我认为这些方法是sbt的主要方法

那么sbt的主要方法在哪里?谢谢!

jordandick 回答: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文件中

发送信号3到JVM或使用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-launcher中的主要方法

https://github.com/sbt/launcher/blob/1.x/launcher-implementation/src/main/scala/xsbt/boot/Boot.scala

来自Main

/** This class is the entry point for sbt. */
final class xMain extends xsbti.AppMain { 
  ...
}

您可以看到它如何从启动程序项目扩展AppMain。但我不确定使这项工作所涉及的魔力。

本文链接:https://www.f2er.com/3119321.html

大家都在问