I have tried to convert a regular Java project to an Eclipse plug-in with Tycho, but something went wrong, and I can't figure out what.
These are the problems (I'm just guessing they're related):
first of all: imports of other projects won't work, even if the other project is in the same workspace
when I open up the plug-in editor on the "Build" tab, I get the following exception: "Resource '/Project/target/classes/META-INF' does not exist."
after the multiple error dialogs with above message are gone, the trees of the "Build" tab are completely empty
I have no idea what could help figuring out that problem, so just ask if you have a hunch.
build.properties
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.acme.project;singleton:=true
Bundle-Version: 1.2.3.qualifier
Bundle-Vendor: ACME
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: [snip]
Import-Package: [snip]
How do I fix my plug-ins?
For reasons that are completely beyond me, there was the following line in the file .settings/org.eclipse.pde.core.prefs of the project:
BUNDLE_ROOT_PATH=target/classes/META-INF
I removed it and now everything works.
(To see the file, you need to either use the native file system or disable the ".* resources" filter of the Package Explorer.)
Related
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.
I am trying to develop an Eclipse plugin. This plugin uses jgit to accecc git repositories over ssh with ubuntu username and password. (Clone git repository over ssh with username and password by Java) Using jgit in this with NetbBeans works just fine. Without a problem it can clone, commit and push projects. However when I move the same code fragment into Eclipse jsch of jgit plugin and the jsch I've added to the project conflicts. If I remove the one I've I added then I cannot compile the code (I need to import com.jcraft.jsch.Session in a class). On the other hand, if it is added I've got the following error
java.lang.LinkageError:
loader constraint violation: loader
(instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
previously initiated loading for a different type with name
"com/jcraft/jsch/Session"
Is there a way out of this mess?
I am using jgit-3.2.0 and jsch-0.1.5.0
Eclipse version is Kepler.
My plugin manifest
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ****
Bundle-SymbolicName: ****;singleton:=true
Bundle-Version: 1.1.0513
Bundle-Activator: ****.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.browser;bundle-version="3.4.100",
org.eclipse.core.resources;bundle-version="3.8.100",
org.eclipse.ui.ide;bundle-version="3.9.0",
org.eclipse.jdt.core;bundle-version="3.9.0",
org.eclipse.core.filesystem;bundle-version="1.4.0",
org.eclipse.team.core;bundle-version="3.7.0",
org.eclipse.jgit;bundle-version="3.2.0",
org.eclipse.jdt.launching;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/commons-io-2.4.jar,
lib/zip4j_1.3.2.jar,
lib/jsch-0.1.50.jar
Most likely, the LinkageError occurs because there are two versions of class com.jcraft.jsch.Session (and other classes from JSch). One comes from the embedded library in your bundle, the other is provided by the com.jcraft.jsch bundle that is very likely present in your OSGi runtime.
Don't put JSch on your bundle-classpath. The JSch classes from your bundle-classpath will clash with the JSch bundle 'outside' .
Use Require-Bundle or Import-Package to declare the dependency. For example:
Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.50,0.2.0)"
I have Eclipse for JEE with Libra installed.
I have 3 OSGI(+Dynamic Web Module Facet) bundles in my Eclipse workspace. The first(let's name it CORE) imports the other 2(DB and MVC) + 3 more packs. DB imports apache-commons(CORE too), MVC has not any imports. All bundles i need are in the Target platform - Gemini, apache-commons, javax.*, etc. When I try to add all the 3 bundles into the Runtime just to start and test them there is this problem.
In the MANIFEST these 2 packs do not import each others. When i try to add only the first bundle(CORE) to the Runtime eclipse crashes with stack overflow. In the server there are infinite dependencies in the DB and MVC bundles between them and i can not continue my work. When i remove the imports from the CORE I can add all 3 bundles without any problem and the runtime starts, CORE bundle is unusable(of course). I tried to create OSGI launcher. There everything works, but the problem is that Equinox OSGI Runtime can refresh(redeploy) my bundles without need to be restarted, but in the launcher i can not do this.
Any help?
Thanks.
EDIT: Some manifest properties
There are not plugins which require each other
CORE manifest:
Bundle-Name: org.proforge.bricks.core
Export-Package: org.proforge.bricks.core
Import-Package: org.apache.commons.configuration;version="1.10.0",
org.apache.commons.lang.exception;version="2.6.0",
org.osgi.framework;version="1.5.0",
org.proforge.bricks.db,
org.proforge.bricks.mvc
DB manifest:
Bundle-Name: org.proforge.bricks.db
Export-Package: org.proforge.bricks.db
Import-Package: org.apache.commons.configuration;version="1.10.0"
MVC manifest:
Bundle-Name: org.proforge.bricks.mvc
Export-Package: org.proforge.bricks.mvc
I put just export/import/name and miss the other properties
I have developed an osgi plugin for Domino. It contains a servlet which needs to check ACL settings.
I have a target platform based on ...Domino/rcp/plugins and ...Domino/shared/plugins. The jre is the installed Domino jre.
The servlet imports lotus.domino and uses lotus.domino.ACL. The plugin manifest contains a dependancy on lotus.domino.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyServletPlugin
Bundle-SymbolicName: MyServletPlugin;singleton:=true
Bundle-Version: 1.0.1.20121026
Bundle-Activator: de.xyz.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: lotus.domino,
org.osgi.framework;version="1.3.0"
Require-Bundle: org.eclipse.equinox.http.registry,
org.eclipse.equinox.http.servlet,
org.eclipse.osgi,
org.eclipse.osgi.services,
org.eclipse.osgi.util,
com.ibm.pvc.servlet;bundle-version="2.5.0"
Bundle-ClassPath: lib/gson-1.6.jar,
.
When I export the plugin using the Export Wizard I get an error.
Errors occured during the export operation.
The log file contains the following:
# 26.10.12 12:33:32 MESZ
# Eclipse Compiler for Java(TM) 0.B83_R37x, 3.7.2, Copyright IBM Corp 2000, 2011. All rights reserved.
----------
1. ERROR in D:\workspace\osgiservlet\WireitServletPlugin\src\de\xyz\AclServlet.java (at line 14)
import lotus.domino.ACL;
^^^^^
The import lotus cannot be resolved
----------
2. ERROR in D:\workspace\osgiservlet\WireitServletPlugin\src\de\xyz\AclServlet.java (at line 15)
import lotus.domino.ACLEntry;
^^^^^
The import lotus cannot be resolved
... and many more like this.
The Domino version is 8.5.3 and eclipse is Indigo SR2.
Add "com.ibm.notes.java.api" as a required plug-in and remove lotus.domino from the imported packages. That should solve the problem.
I think that I have found the cause.
When I set up the project I added a sepate project which just contained the Notes.jar. I assume this was recommended on blog or something.
It had worked ok so I'm not sure what went wrong. In any case, I removed the project and the export is now successful.
I'm developing a plug-in that needs access to the class org.eclipse.swt.widgets.Display. This class is contained in org.eclipse.swt.win32.win32.x86_3.5.2.v3557f-RCP20100710-0200.jar. However, the class is also exported by the manifest in com.ibm.rcp.jfaceex_6.2.2.20100729-1241 as follows:
Export-Package: com.ibm.rcp.jface.action,com.ibm.rcp.jface.launcher,co
m.ibm.rcp.jface.themes,com.ibm.rcp.jface.util,com.ibm.rcp.jface.viewe
rs,com.ibm.rcp.jface.window,com.ibm.rcp.jface.window.effects,com.ibm.
rcp.ui.widgets.api.jface,com.ibm.rcp.ui.widgets.api.swt
Require-Bundle: com.ibm.rcp.swtex,org.eclipse.swt,org.eclipse.core.run
time,org.eclipse.jface,org.eclipse.ui
Now, com.ibm.rcp.jfaceex is not included as part of my JRE System Library. It is, however, a bundle that includes classes of its own, as well as the exported packages above.
I was led to beleve that all I needed to do in my own project was to include a reference to it in my own project's build path, but this does not appear to work. The compiler is unable to resolve import statements against the classes in the org.eclipse.swt.widgets package.
If I need those classes, what, exactly do I need to do to import them correctly, and with the least amount of work?
Note We are not using Maven or any third party build tools. This is mandated by management, and I cannot change it.
UPDATE
Per the suggestion of E-Riz, below, I added org.eclipse.swt to the Required Bundles section of the Dependencies tab of my plug-in. Then, I attempt to export the project as follows:
Right click project, select Export.
Select Plug-in Development -> Deployable plug-ins and fragments
Select All, then click Finish
Eclipse builds the project, then tells me there were errors. Examination of the log reveals the following error:
1. ERROR in E:\NotesDev\Plug-in\com.ibm.lotuslabs.ui\src\com\ibm\lotuslabs\ui\UI.java (at line 1)
/**
^
The type org.eclipse.swt.widgets.Shell cannot be resolved. It is indirectly referenced from required .class files
There are dozens of these throughtout my code; one for every reference to a class or method in the org.eclipse.swt namespace bundle. This, despite the fact that the bundle debugs just fine!
UPDATE 2
I've discovered that you can, in fact, put absolute paths into the Bundle-Classpath in MANIFEST.MF. Oddly, this made the compile-time errors vanish. I am not convinced at this point that this is the correct thing to do, since absolute paths are certainly not guaranteed to correspond to the end-user's configuration.
However, installing the plug-in into Notes (the target platform), is not working as intended.
Notes reports that the plug-in installed successfully, but the plugin (an addition to the toolbar) does not appear. I am assuming, at this point, that something with the classpaths still isn't right.
UPDATE 3
Per request, the MANIFEST.MF and build.properties files. Please note that absolute paths were added by Eclipse, through the Dependencies and Runtime tabs.
MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Context Plug-in
Bundle-SymbolicName: com.ibm.lotuslabs.context.service;singleton:=true
Bundle-Version: 1.0.2
Bundle-Vendor: IBM
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Activator: com.ibm.lotuslabs.context.service.internal.ContextPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: context.jar,
lib/activation-1.1.1.jar,
lib/mail.jar,
lib/SatuitCRM_XML_API2.jar,
lib/commons-lang3-3.1/commons-lang3-3.1.jar,
E:/NotesDev/Notes/framework/rcp/eclipse/plugins/org.eclipse.swt.win32.win32.x86_3.5.2.v3557f-RCP20100710-0200.jar
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.views,
org.eclipse.swt,
com.ibm.rcp.swtex,
com.ibm.rcp.jfaceex,
com.satuit.core
Export-Package: com.ibm.lotuslabs.context.service.document,
com.ibm.lotuslabs.context.service.internal
Import-Package: org.eclipse.core.resources
build.properties:
output.. = bin/
bin.includes = META-INF/,\
context.jar,\
lib/activation-1.1.1.jar,\
lib/mail.jar,\
lib/commons-lang3-3.1.jar,\
lib/SatuitCRM_XML_API2.jar,\
plugin.xml,\
E:/NotesDev/Notes/framework/rcp/eclipse/plugins/org.eclipse.swt.win32.win32.x86_3.5.2.v3557f-RCP20100710-0200.jar
jars.compile.order = context.jar
source.context.jar = src/
Just because a bundle names a package in its Export-Package declaration does not necessarily mean that it contains the code for that package. A bundle can export packages from bundles that it depends on (although I think that's generally a bad idea in most cases).
For you, the solution is simple: in your MANIFEST.MF go to the Dependendencies tab and add org.eclipse.swt to the list of Required Plug-ins
Not quite sure, but two things come to mind.
Either remove the jar from your project classpath and add the com.ibm.rcp.jfaceex jar to your target platform (Preferences->PDE->Target platform and point to a directory containing the com.ibm.rcp.jfaceex jar)
Or leave the reference and also add the jar to your bundle classpath (on the runtime tab of the MANIFEST)
It don't quite see how this would result in this error, but classpath problems can manifest themselves in weird ways in PDE.
I have taken a look at the swt related bundles in eclipse juno:
org.eclipse.swt_3.100.0.v4233d.jar
org.eclipse.swt.win32.win32.x86_3.100.0.v4233d.jar
The widgets are in the second bundle which is a fragment to the first.
So you have to make sure both bundles are in the target platform. I am not sure if require bundle works in that case (it may work). You may try to instead import all packages you need.
Especially you need Import-Package on the package org.eclipse.swt.widgets.