I would like to weave an aspectj into an existing plugin of elipse-based RCP program.
I don't have the source code of the plugin and what my aspectj want to do is to print a log when executing a specific method in the target plugin.
Below is what my steps, however it doesn't work, Could you someone suggest how to achive it.
1) I downloaded AJDT plugin in my Eclipse and create my AspectJ progect including my aspect file.
2) In the AspectJ project properties, specify the target plugin name in the "Inppath" . Here , Let's say the target plugin name is AAAA_1.0.jar and specify the same name mytest_1.0.jar in the "Output" jar.
3) Build the my aspectj project, and get the new AAAA_1.0.jar with my aspectj included.
4) Then I modify the MANIFEST.MF of AAAA_1.0.jar, add the "org.aspectj.runtime" into the "Require Bundle".
5) Then I replace the AAAA_1.0.jar of the RCP program with the new created one.
6) copy the <My Eclipse Installation Folder>/plugins/org.aspectj.*.jar into <My RCP>/plugins/
7) copy the <My Eclipse Installation Folder>/features/org.aspectj_1.8.5.20150128171000 into <My RCP>/features/
8) copy all aspectj related entries defined in the <My Eclipse Installation Folder>/artifacts.xml ino my <My RCP>/artifacts.xml
9) then run my RCP, However my aspect doesn't work and RCP prints the error :
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/NoAspectBoundException
<I removed some stack trace here>
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.NoAspectBoundException cannot be found by <my target jar name>
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
It seems org.aspectj.runtime can't be found. Any advice how to solve it?
Or is there any guide if I want to add a aspectj into a exsisting plugin which has no source code?
Best Regards
Bruce