解决Karaf控制台dev:watch失效的问题

来源:互联网 发布:大数据利用过程是 编辑:程序博客网 时间:2024/05/29 14:09

在实际的开发过程中,经常会不断的重复着发布,重启服务等使人非常烦躁的问题,在Karaf环境下,可以轻松的避免这个问题了。

那就是dev:watch命令,通过输入dev:watch 【BundleID】,就可以轻松的监控你安装的bundle了。这个需要说明的就是,只能监控snapshot版本。官方命令参考

下载karaf的2.3.3,在console下输入mvn:com.liming.platform.osgi-project/com.liming.platform/1.0-SNAPSHOT,这是我的测试bundle,就是控制台输出一段文字。

然后输入dev:watch 69,dev:watch --start,此时修改源代码,install,发现并没有出现更新。

解决的办法是这样的,打开/etc/org.ops4j.pax.url.mvn.cfg,编辑以下:

        

#   * 4. if not found looks for ${M2_HOME}/conf/settings.xml#org.ops4j.pax.url.mvn.settings = file:D:\\JavaTools\\apache-maven-3.0.4\\conf\\settings.xml## Path to the local Maven repository which is used to avoid downloading# artifacts when they already exist locally.# The value of this property will be extracted from the settings.xml file# above, or defaulted to:#     System.getProperty( "user.home" ) + "/.m2/repository"org.ops4j.pax.url.mvn.localRepository=D:\\maven\\repository

注意:

org.ops4j.pax.url.mvn.localRepository这行必须要打开,这样就可以享受dev:watch给我们带来的服务了。