如何将equinox Weaving与bndtools结合使用,因为equinox Weaving示例已经过时,无法使其工作。
最新情况:
当尝试运行Hello world的编织示例时
我有两包:
public class HelloService implements BundleActivator {
public void start(final BundleContext context) throws Exception {
System.out.println("Hello world!");
}
public void stop(final BundleContext context) throws Exception {
System.out.println("Good bye world!");
}
}bnd.bnd
-buildpath: \
osgi.core,\
osgi.cmpn,\
biz.aQute.bnd.annotation,\
${junit}
Bundle-Version: 0.0.0.${tstamp}
Require-Bundle: helloaspect
Export-Package: \
com.weaving.hellohistorytest
Bundle-Activator: com.weaving.hellohistorytest.HelloService方面束:
@Component
@Aspect
public class HelloAspect {
/**
* Replaces the "Hello world!" output with "Hi from HelloAspect ;-)".
*/
@Before("execution(* HelloService+.*(..))")
public void advice() {
System.out.println("hello aspect");
}
}bnd.bnd
-buildpath: \
osgi.core,\
osgi.cmpn,\
biz.aQute.bnd.annotation,\
${junit},\
aspectjrt-1.7.3,\
aspectjweaver,\
org.eclipse.equinox.supplement
Bundle-Version: 0.0.0.${tstamp}
Service-Component: \
*
Export-Package: \
com.weaving.helloaspect;aspects="HelloAspect"
Eclipse-SupplementBundle: com.weaving.hellohistorytestlaunch.bndrun
runbundles: \
org.apache.felix.gogo.runtime,\
org.apache.felix.gogo.shell,\
org.apache.felix.gogo.command,\
org.eclipse.equinox.weaving.aspectj,\
org.eclipse.equinox.weaving.hook,\
aspectjweaver,\
aspectjrt-1.7.3,\
osgi.cmpn,\
osgi.core,\
cnf.run.equinox.common,\
org.apache.felix.framework,\
osgi.enterprise,\
org.eclipse.equinox.supplement,\
helloaspect;version=latest,\
hellohistorytest;version=latest,\
-runproperties:\
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
-runrequires:\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)'
-runvm: -Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook,\
-Daj.weaving.verbose=true,\
-Dorg.aspectj.weaver.showWeaveInfo=true,\
-Dorg.aspectj.osgi.verbose=true当我运行启动:我得到Hello而不是hello方面,方面编织钩子插件(孵化器)被设置为解决。
有什么问题吗?
发布于 2015-05-13 09:56:08
在GitHub上可以找到一个可用的源代码示例。
通常,这里指令也适用于与bndtools一起使用。
添加所需的包
-runbundles: \
org.eclipse.equinox.weaving.aspectj,\
org.aspectj.runtime,\
org.aspectj.weaver确保org.eclipse.equinox.weaving.hook位于同一位置。
-runpath: org.eclipse.equinox.weaving.hook并且您需要在*.bndrun中提供以下运行属性
-runproperties:\
osgi.framework.extensions=org.eclipse.equinox.weaving.hook下列运行时属性可选地用于调试。注意,输出总是进入std.err流,即使它们正常工作)。
aj.weaving.verbose=true,\
org.aspectj.weaver.showWeaveInfo=true,\
org.aspectj.osgi.verbose=true,\https://stackoverflow.com/questions/30210725
复制相似问题