Why can I not access all plugins in my target definition?
Asked Answered
U

2

15

I have a problem concerning target definitions in Eclipse. I want to use plugin version 1.0.0, which is in my target platform definition, while I have the plugin project in my workspace with version 1.0.2. For all other plugins in my target definition, everything works as expected (which I see because an error gets flagged if something's missing), but this specific one, Eclipse does not make available to my projects. Only the plugin version 1.0.2 is. The plugin is not set as a singleton.

Why is this and how can I resolve this problem?


I figured out that I can access the right version when I close the project that contains the wrong one - but this is awkward, is there another way?


It seems that it's actually not an eclipse-specific problem, it fails also when building on the command line through maven/tycho. Specifically, my target platform is the Juno Release. Are there plugins that, while part of a feature, are not made available to other bundles? I know the plugin is there, but neither tycho nor Eclipse want to make it available to me.

Maybe I should also say it fails at compile time.


While, as I said, there exist workarounds for the problem, I still would like to have a "nice" solution to this problem. You can check out the project together with the target definition at https://github.com/kutschkem/Jayes

You may also need to check out and build this project first: git clone http://git.eclipse.org/gitroot/recommenders/org.eclipse.recommenders.git

After setting the target platform, try building something with Jayes 1.0.0 (which is in the target platform) instead of Jayes 1.0.2 (which is in your workspace). You can also try to build with maven, it doesn't work as well.

Known workarounds:

  1. Close the Jayes 1.0.2 project. Then, eclipse lets you use Jayes 1.0.0
  2. For running an (OSGi) application, you can choose which bundles are loaded. You can choose version 1.0.0 manually there
  3. Using a product definition, you can access the same runtime configuration as for workaround 2

If someone finds a workaround for maven, I'd be happy to know about it.

Ulberto answered 11/12, 2012 at 7:42 Comment(0)
A
7

Maybe you have set your plugin to be singleton, so there will only be one instance for the bundle with a specific id. You can change this by remove the "singleton:=true" in your MANIFEST.MF.

Bundle-SymbolicName: org.eclipse.xxx; singleton:=true

Or, you could remove the 1.0.2 version plugin from the run configuration when start running. click run --> run configuration to open the run configuration dialgo, switch to 'plugins' tab, here you can select which of these plugins you want to use .

Antemeridian answered 12/12, 2012 at 7:54 Comment(2)
Thanks for those hints, i clarified my question with regards to your answer. In run configurations, i don't get that tab for a class that just has a main-Method. The problem also already shows when i try to add the dependency, that is, before i even run anything.Ulberto
btw your workaround was added to the question. The tab shows up when i have an eclipse application instead of a plain java main method. This still doesn't solve the problem in general, for example when i want to automate the execution with maven.Ulberto
I
4

I think you have already tried the following, but a reload of the target platform might help. Also, what does your feature.xml file specify for version of that plugin?

Invest answered 18/12, 2012 at 21:50 Comment(5)
It specifies 0.0.0. And yes, i did reload the target platform, but actually, as i wrote, this is not even an eclipse-specific problem.Ulberto
Interesting (plugin-feature.xml version thing i mean) - so what if you like specify the version you want there?Invest
Well, i can't really influence that in the remote repository (Juno release...). Locally, it lets me do that, but it still flags the plugin as unavailable (weird enough, this warning even comes when i have the 1.0.2 project closed)Ulberto
Did you try just not to export the plugin with the higher version to maybe force eclipse to take your lower version plugin?Invest
First of all, this is not eclipse-specific, it also fails on the command line with maven. Second, i think it actually works inside eclipse when i either (i) use the run configuration to select which plugins are there at runtime (haven't tested though), (ii) close the project that contains the new version. Both of these do seem to be eclipse specific (inside my feature.xml, if i explicitly set 1.0.0, it still complains that that version is not available). I don't like those work-arounds, it hard for me to believe there's not a way to achieve what i want just with maven an "normal" ways.Ulberto

© 2022 - 2024 — McMap. All rights reserved.