Given that all p2 devs seem to be busy, I suggest that you run your code, which installs features, in a debugger and try to understand how exactly the path to target folder is built. Maybe, you'll see where the wrong value comes from and how to make sure the right value is used. I think it's a better approach than to override properties at runtime.
Concerning your attempt to change PROP_CACHE value, it seems that you call IProfileRegistry.setProfileStateProperty and expect IProfile.getProperty to return the new value. I guess that a profile state property and a profile property are not the same things, and that's why your attempt failed.
"Dileepa Jayakody" <dileepa@xxxxxxxx>To:
"P2 developer discussions" <p2-dev@xxxxxxxxxxx>Sent:
Wednesday, February 27, 2013 10:34:42 PMSubject:
[p2-dev] How to override Profile Properties ?
Can I please know whether it's possible to override Profile properties at runtime?
What I'm looking for is a way to override the bundle-pool location used by the Profile to extract features and plugins during feature installation.
In a previous thread, I learned that the bundle pool location (/features, /plugins directories) is located by the org.eclipse.equinox.p2.cache property value.
I gave this as a profile property when invoking p2-director. I'm also using -roaming enabled for my application.
However during runtime, I see that the org.eclipse.equinox.p2.cache property is initialized to /dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components/WSO2CarbonProfile
This is not the place I specified p2.cache to point to. I want it to be pointed to /dileepa/kernel/trunk/distribution/kernel/target/wso2carbon-core-4.1.0-SNAPSHOT/repository/components
(I suspect with -roaming enabled, the profile-property value I set for p2.cache has been modified internaly by P2)
As there is no direct method to override the p2.cache profile property, I tried ;
profileRegistry.setProfileStateProperty(IProfileRegistry.SELF, timeStamp, "org.eclipse.equinox.p2.cache", System.getProperty("carbon.home") + File.separator + "repository" + File.separator +"components");
But this was not successful and the features were still extracted at repository/components/WSO2CarbonProfile directory and the p2 instructions to copy certain files during feature installation fail, due to incorrect file-paths to source.
Then I learned that my change above using setProfileStateProperty() is not useful at all since in p2.touchpoint.eclipse.util  uses;
profile.getProperty(IProfile.PROP_CACHE); and not profile.getPropertyState()
Can I please know a way to override the p2.cache property for my running profile during runtime?
p2-dev mailing list