Controlling dependency startLevel [message #1839177] |
Tue, 16 March 2021 16:43  |
Eclipse User |
|
|
|
We are using p2 to provision our servers using p2 Update Sites that we build.
Recently, I have upgraded Jetty to a newer version. Our UpdateSite contains all required jetty bundles. Some of our bundles contain JSP pages. The default bundle startLevel is 4, and so when we provision our changes, Jetty + our own bundles end up with startLevel 4 in bundles.info file.
This is an issue because if our JSP containing bundles start before jetty bundles that offer JSP support, the Bundle Tracker will miss them and will not configure WebAppContext correctly.
I need org.mortbay.jasper-apache-jsp bundle to start before our bundles do.
I have tried unpacking the source bundle jar and added p2.inf file inside META-INF directory and repacked the jar.
I can't get it to work correctly, the following is my p2.inf content:
#create a requirement on the fragment we are creating
requires.0.namespace=org.eclipse.equinox.p2.iu
requires.0.name=configure.org.example.bundle
requires.0.range=[$version$,$version$]
requires.0.greedy=true
#create a IU fragment named configure.<org.myBundle>
units.0.id=configure.<org.myBundle>
units.0.version=$version$
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=configure.org.example.bundle
units.0.provides.1.version=$version$
units.0.instructions.install=org.eclipse.equinox.p2.touchpoint.eclipse.installBundle(bundle:${artifact});
units.0.instructions.uninstall=org.eclipse.equinox.p2.touchpoint.eclipse.uninstallBundle(bundle:${artifact});
units.0.instructions.unconfigure=org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:-1); \
org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:false);
units.0.instructions.configure=org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:3); \
org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:true);
units.0.hostRequirements.1.namespace=osgi.bundle
units.0.hostRequirements.1.name=<org.myBundle>
units.0.hostRequirements.1.range=[<v>, <v>]
units.0.hostRequirements.1.greedy=false
units.0.hostRequirements.2.namespace=org.eclipse.equinox.p2.eclipse.type
units.0.hostRequirements.2.name=bundle
units.0.hostRequirements.2.range=[1.0.0,2.0.0)
units.0.hostRequirements.2.greedy=false
units.0.requires.1.namespace=osgi.bundle
units.0.requires.1.name=<org.myBundle>
units.0.requires.1.range=[<v>, <v>]
units.0.requires.1.greedy=false
When I include this in the jsp bundle, the provisioner fails to install the bundle.
I have tried debugging with org.eclipse.equinox.p2.core/planner/projector=true but that doesn't give me a lot of info why the config fragment dependency is not satisfied.
Any suggestions how I can get this to work? I've been extensively searching the web but no luck.
|
|
|
|
Re: Controlling dependency startLevel [message #1839209 is a reply to message #1839188] |
Wed, 17 March 2021 10:38  |
Eclipse User |
|
|
|
Hi Ed,
Our bundles containing JSP pages already do this, but unfortunately, it doesn't resolve the issue. I will look into debugging the starting order some more to have a better understanding of when the bundle tracker is invoked (might be on installed step).
We don't make a use of .project file, we have written a Provisioner implementation to handle provisioning and p2 profile changes by executing a ProvisioningPlan. The bundles.info file is used by the profile to dictate the starting order.
Manifest file includes the following requirements:
Require-Bundle: org.eclipse.jetty.apache-jsp;bundle-version="9.4.37",
org.mortbay.jasper.apache-jsp;bundle-version="8.5.54",
org.mortbay.jasper.apache-el;bundle-version="8.5.54"
|
|
|
Powered by
FUDForum. Page generated in 0.04336 seconds