在 Eclipse 中调试 Karaf 包:persist dev:watch URLs/IDs? [英] Debug Karaf bundles in Eclipse: persist dev:watch URLs/IDs?

查看:25
本文介绍了在 Eclipse 中调试 Karaf 包:persist dev:watch URLs/IDs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够从 Eclipse 轻松调试在 Apache Karaf 中运行的 OSGi 包.到目前为止,我确定的最简单的方法是创建一个启动 Karaf 的 Java 应用程序启动器.如果之前安装了捆绑包,那么我可以设置断点,即使是在激活器中,一切都很好.

I want to be able to easily debug an OSGi bundle running in Apache Karaf from Eclipse. The easiest way I've identified so far is to create a Java Application launcher that starts Karaf. If the bundle was previously installed then I can set breakpoints, even in the activator, and all is good.

问题是,当对代码进行更改时,调用了 mvn install,然后调用了 Eclipse Karaf 启动器,我运行的是旧的缓存版本的包.我玩过从命令行运行 Karaf,使用 Maven URL 安装我的包,并成功使用 dev:watch.但我发现 dev:watch URL 没有保留.因此,当从 Eclipse 启动 Karaf 时,没有被监视的 URL(以前的 URL 在 Karaf 关闭时丢失)并且没有安装新版本的包.

The issue is that when a change is made to the code, mvn install invoked, and then the Eclipse Karaf launcher invoked, I am running the old cached version of the bundle. I have played with running Karaf from the command line, installing my bundle with a Maven URL, and using dev:watch with success. But I have found that the dev:watch URLs are not persisted. Thus, when starting Karaf from Eclipse, there are no watched URLs (the previous ones were lost when Karaf was shutdown) and new versions of the bundle are not installed.

有没有办法让 dev:watch URL 持久化?我寻找可能包含 URL 的属性,或者甚至可以用来指定 URL 的 Karaf 命令行选项,但没有运气.我什至尝试将 dev:watch 命令添加到 etc/shell.init.script,但我在 Karaf 启动时收到此消息初始化脚本中的错误:找不到命令:dev:watch."我认为这意味着该命令在 Karaf 启动序列中运行得太早(开发功能尚未启动?).

Is there a way to get the dev:watch URLs to be persistent? I looked for either properties that might hold the URLs or even Karaf command line options that could be used to specify the URLs with no luck. I even tried to add the dev:watch command to etc/shell.init.script but I get this message at Karaf startup "Error in initialization script: Command not found: dev:watch." I assume this means the command was run too early in the Karaf startup sequence (dev feature not yet started?).

任何帮助将不胜感激,即使是我没有考虑过从 Eclipse 轻松调试在 Karaf 中运行的包的替代方法.目标是避免每次代码更改时都需要使用手动命令,例如 osgi:install.

Any help would be appreciated, even alternate ways I haven’t considered to easily debug bundles running in Karaf from Eclipse. The goal is to avoid needing to use manual commands such as osgi:install every time the code changes.

推荐答案

Karaf 团队现在也在努力与 EIK 更好地集成,但目前它还没有达到所需的深度集成.因此,您提供的方式基本上是进行调试的最佳方式.使用 maven 构建您的应用程序,在您的 karaf 启动并运行时执行 dev:watch.由于 dev:watch 是一个开发时间"命令,它并不打算是持久的.但是您仍然可以选择历史记录,当然您可以为命令提供多个包 ID.

The Karaf team is now also working on a better integration with EIK, but at the current time it's not yet as deeply integrated as it would be needed. Therefore your provided way is basically the best way in doing debugging. Build your application with maven, do a dev:watch when your karaf is up and running. Since dev:watch is a "Development-Time" command it's not intended to be persistent. But you still have the history to choose from and of course you're able to provide multiple bundle IDs to the command.

这篇关于在 Eclipse 中调试 Karaf 包:persist dev:watch URLs/IDs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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