I have created a OSGI bundle A and a jar B, A is dependent on B. I also successful deployed A and B on Karaf 4.1.1. B is deployed as wrapped maven jar (bundle:install -s mvn:....).
Now B has some changes, so I have redeployed it into our Nexus server, I also want to deploy the new B into Karaf.
But I found, if I only update B in Karaf, A is still using old B, even I have restart A. I have to uninstall and re-install B to make A use the new B.
Since B is a common library, there will be many other bundles will dependent on B. And B is also used by our other non-OSGI applications, so I don't want make it as OSGI bundle.
Is it the correct way to update wrapped-maven Jar in Karaf? Or any suggestion?
The problem is not related with "wrapped component". After being installed with wrap protocol, a jar is considered like a normal OSGI bundle.
But, Remember that Karaf watch changes only from SNAPSHOT bundles.
So:
In your developpement environnement, bundle B may be in SNAPSHOT version. So you can watch your changes immediately (just be sure to hit bundle:watch * in your karaf command line). Bundle A detect B's changes immediately also.
In your production environnement, bundle B must be in a released version. So to deploy your new changes in B, you must install it's new version and remove the old one.
If you want to let B deployed with two different version, and force A to use the new version, you have to make some changes into bundle A by modifying the import packages like this:
... bundle_B_package*;version="[bundle_B_new_version,bundle_B_new_version + 1)", ...
Here we are applying semantic versioning :)