Ninja 框架:通过 Eclipse 和 m2eclipse 插件进行调试 - jetty:run 不启动服务器,而是构建

Ninja Framework : Debugging via Eclipse and m2eclipse plugin - jetty:run does not start the server, builds instead

我们被指示执行以下操作(在使用 Eclipse 时)

And if you make a left click on your project you get the option “Debug as…”. Hit that and generate a profile that debugs the goal jetty:run.

https://www.ninjaframework.org/documentation/debugging.html

但是,当我们执行jetty:run时,我们只是简单地构建项目,而项目并没有启动。 此外,当我们 运行 和 ninja:run 时,调试不会在断点处停止。

我需要的是一个在断点处停止的调试模式。

我们如何解决这个问题?

答案在 Ninja Framework 源代码和 Jetty 的新版本中......因此,如果不重新编译整个框架来解决问题,(可能)没有答案。我已经尝试了 diff-ing 个项目,但看不到任何可以修复更高版本的东西。直到版本 6.4.0(含)运行 命令 mvn jetty:run 启动服务器。高于 6.4.0 的任何其他版本只是构建项目然后停止。

因此,解决方案之一是使用 old-version 代码执行来简单地启动一个新项目:

mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-servlet-archetype-simple -DarchetypeVersion=6.4.0

另一种解决方案是部署(Jetty 或 Tomcat 服务器)并尝试调试部署的 jar/war 文件。

第一种方案比较简单,第二种方案更合适。

撰写本文时,最新版本是

<ninja.version>6.6.1</ninja.version>
<jetty.version>9.4.18.v20190429</jetty.version>