Eclipse Oxygen plug-in Missing Constraint: Import-Package - eclipse

I am writing a plug-in for Eclipse Oxygen that allows External Tools to be run directly from toolbar buttons. When I right click the project and click Run As Eclipse Application I get a pop-up that shows the following errors
javax.xml.ws
Missing Constraint: Import-Package: java.xml.bind; version="0.0.0"
Missing Constraint: Import-Package: java.xml.bind.annotation; version="0.0.0"
org.apache.xmlrpc
Missing Constraint: Import-Package: java.xml.bind; version="0.0.0"
If I click Continue, Eclipse launches with the plug-in and it operates correctly. I have tried following the advice here to open the 'Run Configuration' and select 'Add Required Bundles' (although using Add Required Plug-ins as there is no bundles button) but it doesn't help. I neither can see javax.xml.bind in the list nor a way to add it.
The project itself is very simple with the following dependencies
org.eclipse.core.runtime
org.eclipse.debug.ui
org.eclipse.jface
and extensions
org.eclipse.debug.core.launchers
org.eclipse.ui.commands
org.eclipse.ui.handlers
org.eclipse.ui.menus
I have listed the dependency hierarchy and javax.xml.bind is not listed.
How can I add the dependencies or clear the errors?

It seems, these two packages (java.xml.bind and java.xml.bind.annotation) are missing in your target platform.
Adding the javax.xml.bind plug-in (which can be download from Eclipse Orbit, e. g. here) to your target platform should fix the problem.

Related

How to use Java11 (Java10) with Eclipse Plugin?

If I specify JavaSE-10 as minimum execution environment in my Eclipse plugin:
I get following errors when starting my plugin as Eclipse Application:
org.osgi.framework.BundleException: Could not resolve module: org.treez.core [597]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
Unresolved requirement: Require-Bundle: org.treez.javafxd3; visibility:="reexport"
-> Bundle-SymbolicName: org.treez.javafxd3; bundle-version="1.0.0.qualifier"; singleton:="true"
org.treez.javafxd3 [586]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
I checked that
Java10 is reverenced under Installed JREs
10 is selected as compliance level
I use Oxygen.3a Release (4.7.3a) Build id: 20180405-1200
=>Is this a bug in eclipse equinox?
=>What else can I check to resolve this issue?
If I remove JavaSE-10 from the minimum execution environment settings I am able to start the Eclipse Application and the plugin seems to work fine.
When I export the plugin I get following warning:
# 25.04.18, 12:25:40 MESZ
# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
option -bootclasspath not supported at compliance level 9 and above
When I try to use the plugin after installing it from my update page, I get a ClassNotFoundException:
...
Caused by: java.lang.ClassNotFoundException: org.treez.views.tree.TreeViewPart cannot be found by org.treez.views_1.0.0.201804191641
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 114 more
If I use Java8 everything works fine.
Related questions:
Java 8 & Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))"
How to set up java 10 in Eclipse Oxygen?
How to add org.eclipse.swt (and other plugin dependencies) as an automatic Java9 module?
It looks like Eclipse OSGi does not support Java SE 10 yet. I downloaded the latest Eclipse Oxygen 4.7.3a and opened plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar. The last supported profile was JavaSE-9.
So, you have two choices here:
Wait until OSGi officially supports JavaSE-10 profile.
If you really want to write a plugin with Java 10 and you have control over the plugins folder (e.g. you develop an Eclipse RCP application), open the OSGI jar and add a new profile JavaSE-10. To do this, you can copy JavaSE-9.profile to JavaSE-10.profile and fix corresponding lines in the new file. Also, you must add a new line to profile.list.
Since OSGi 4.3, the most appropriate way to specify a minimum Java version is using the Required-Capability header, as in:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.10))"
I have had success fixing the reported error by replacing all occurrences of Bundle-RequiredExecutionEnvironment with the above line. In PDE, you may get a warning on the manifest file, but it can be safely ignored. Product validation and product exports seems to work without issue.
The semantic of the BREE header required that an execution environnement descriptor be provided by the OSGi implementation for each specific release of the JRE. In Equinox, this used to be defined through ".profile" files; these profiles have been supported by Equinox up to JavaSE-9, but it has been announced that Equinox they would no longer provide profiles for newer releases of Java.
The Tycho community has handled this issue on their side by creating their own Java 10 profile, but it can't be used directly from PDE. The P2 community is considering copying Tycho's Java 10 profile, but this has been stalled for a long time. I'm not sure how P2 reacts at present when fed bundles that do not contains the BREE header.
What worked for me as a work around was to
Remove the required version entries from the manifest files and ignore the corresponding warnings
Activate the option "Use class files compiled in the workspace" in the export wizard:
(Therefore I assume that something goes wrong during the compilation step of the export wizard if that option is not applied.)
I used Java 11.0.1 and Eclipse SimRel 2018-09 (plus Java11 support plugin)

Cannot add an eclipse plugin, the plugin won't show up inEclipse

I am trying to add an eclipse Elugin (http://www.cs.wm.edu/semeru/TopicXP/) to my eclipse. I followed the instructions (copied the jar file into the plugins folder), but the plugin won't appear at all.
I do not have the LDA option in the right click menu
I do not have anything under Window > Show View > ...
I don't even see the plugin under Installation Details > plug-ins
I am in the Project Explorer, and using Eclipse Kepler Service Release 2. I did also try Eclipse Luna, as well as Eclipse 3.5 (the version of Eclipse that is mentioned in the plugin page) but none of these worked.
I did check the manifest and I have all required bundles. I also added Java 1.7 to it, since my environment is 1.7.
I cannot think of any reason, the plugin won't show up at all. I assumed that if there are some comparability issues, I will at least see the plugin or some errors related to loading it, but I see nothing.
Ideas?
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TopicXP
Bundle-SymbolicName: edu.wm.topicxp;singleton:=true
Bundle-Version: 0.2.4
Bundle-Activator: edu.wm.LDATopics.LDATopics
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.apache.luc
ene,org.eclipse.jface,org.eclipse.ui.ide,org.eclipse.ui.workbench
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7, J2SE-1.5
Bundle-ClassPath: .,lib/args4j-2.0.6.jar,lib/JGibbLDA.jar
Import-Package: org.eclipse.core.resources,org.eclipse.draw2d,org.ecli
pse.draw2d.geometry,org.eclipse.jdt.core,org.eclipse.jdt.core.dom,org
.eclipse.jdt.ui,org.eclipse.jface.text,org.eclipse.ui,org.eclipse.ui.
ide,org.eclipse.ui.texteditor
Old question, but this may help someone still. This sounds very similar to a problem I struggled with. It's likely that the plugin you are trying to load has unresolved dependencies, and Eclipse doesn't show you anything in that case. But you can find out if that's the problem, and what dependencies may be missing by using the OSGI console.
First, invoke Eclipse from command line and add '-console' option.
Then in the OSGI console, use 'install' command to try to load your plugin. For instance, if you have placed com.my.plugin in the plugins folder of your Eclipse installation:
osgi> install reference:file:plugins/com.my.plugin.jar
That will give you a bundle ID in the output. Use that with the 'diag' command to see any missing dependencies.

eclipse navigator display icon file as is

I have a folder which just contains 16x16 png icons in my rcp project.
I wonder is there a way or a hack, can make the package explorer display these icons files as is. that will make me feel convenient.
these icons is displayed as a normal document.
when I try to install PDE-tool on indigo for rcp:
Cannot complete the install because one or more required items could not be found.
Software being installed: Jeeeyul's PDE-Tools 1.1.0.201211201045 (net.jeeeyul.pdetools.feature.feature.group 1.1.0.201211201045)
Missing requirement: PDE-Tools 1.1.0.201211201045 (net.jeeeyul.pdetools 1.1.0.201211201045) requires 'bundle org.eclipse.ui.trace 0.0.0' but it could not be found
Cannot satisfy dependency:
From: Jeeeyul's PDE-Tools 1.1.0.201211201045 (net.jeeeyul.pdetools.feature.feature.group 1.1.0.201211201045)
To: net.jeeeyul.pdetools [1.1.0.201211201045]
------------------------------------------------------------------------------- edit
I just copyed the org.eclipse.ui.trace.jar from eclipse 4.2(juno) into eclipse 3.7(indigo) rcp, then installed PDE-Tools successfully. It seems work for me!
Install the PDE tools plugin. It has an icon preview decorator, which shows the content of the icons instead of the standard icon.

Tycho cannot resolve Require-Bundle: org.sample.ide.common;bundle-version="1.0.0.qualifier"

I build an Eclipse plug-in project with Tycho.
I got this error message.
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.sample.ide.core 1.0.0.qualifier
[ERROR] Missing requirement: org.sample.ide.core 1.0.0.qualifier requires 'bundle org.sample.ide.common 1.0.0' but it could not be found
org.sample.ide.core-1.0.0.qualifier has org.sample.ide.common-1.0.0.qualifier as required bundle.
When I export the plug-in project with the Eclipse PDE export function, the dependent projects are recognized inside the same workspace.
And my manifest.mf has version like 1.0.0.qualifier, and my pom.xml has 1.0.0-SNAPSHOT. Is that problem?
Having artifacts with .qualifier versions is supported, so this is not the cause of your problem.
However I am not sure to what extend Tycho also supports .qualifier replacement in dependencies, e.g. Require-Bundle headers. (At least, this is buggy.) So you should try to build your project with a dependency to version 1.0.0 instead of 1.0.0.qualifier.
Tycho replaces the .qualifier with a timestamp or fixed string in the reactor build within all manifest files. It resolves the files from the repositories defined from the target files attached, and from the local repository. If none of these contain an exactly matching dependency, tycho will not succeed with the build.
Note that the resolution of PDE export is based on the current target set in Eclipse, and that PDE will replace the qualifier for all bundles open in the workspace. Tycho does not know of these, its scope is what is included in the reactor during the build.

Weird missing constraint with Logback under Eclipse

I have a feature-based launch configuration for an Eclipse RCP product. The feature includes ch.qos.logback.classic, ch.qos.logback.core 0.9.29, and org.slf4j.api 1.6.1. "Validate plugins" shows this error:
Could not find matching capability for Require-Capability: generic; filter="(&(generic=org.slf4j.impl.StaticLoggerBinder)(&(version>=1.6.0)(!(version>=1.7.0))))"
even though ch.qos.logback.classic exports org.slf4j.impl 1.6.1 and I can see StaticLoggerBinder.class in the .jar file. What might the problem be?
This is a guess: the "Require-Capability" is an OSGi 4.3 feature that corresponds to a "Provide-Capability". Logback doesn't have any such manifest header.
https://github.com/ceki/logback/blob/master/logback-classic/pom.xml#L339