Eclipse Plugin only contains manifest - eclipse

I am attempting to develop an Eclipse plugin. The plugin runs from inside Eclipse (i.e. when I launch a test instance of Eclipse with my plugin from inside Eclipse, I can use the plugin in the test instance.)
However, when I attempt to generate a plugin that could be installed by other systems using File > Expoort > Deployable Plug-ins and fragments, the zip file created, contains a single jar file which itself contains only a manifest file:
$ jar tvf com.foo.bar_1.0.0.d.jar
0 Wed Feb 10 12:14:12 EST 2016 META-INF/
863 Wed Feb 10 12:14:10 EST 2016 META-INF/MANIFEST.MF
For example, it does not include my icons or my plugin.xml file.
I am not (yet) using maven-tycho or any other extra-Eclipse means of building the plugin.
Can anyone suggest what I may be doing wrong?

You must list everything you want in the plugin in the build.properties file, so check that file. When you run from within Eclipse this file is not checked for accuracy but it must be correct when you export.
For a simple plugin it might look something like:
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/
source.. = src/
This is including the 'META-INF' folder, the 'bin' folder (where your class files are), the 'plugin.xml' file and the 'OSGI-INF' folder.
In the plugin.xml editor use the 'Build' tab to set the contents of this file.

Related

Add xml file to Eclipse Plugin

I have a file model.xml i want to add to my eclipse plugin to read at runtime.
I tried adding it to the manifest.mf binary build and source build and adding it to the build.properties bin.includes but when I look in the bin folder there are only .class files.
Surely plugins can contain resources and not just .class files right?
You just list the file in the bin.includes in the build.properties - you should be able to do that in plugin.xml/MANIFEST.MF/build.properties editor.
For example in one of my plugins the build.properties is:
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml,\
fragment.e4xmi
source.. = src/
Which includes a plugin.xml and a fragment.e4xmi file.
Note: These are not copied to the bin directory in your project. When you test your plugin they will be accessed directly in the project. When you build/export your plug-in they will be included in the plugin jar.
You use the FileLocator API to access these files - that understands where to look.
For example, to access the fragment.e4xmi shown above:
Bundle bundle = FrameworkUtil.getBundle(getClass());
// or some other way to get the current bundle
URL url = FileLocator.find(bundle, new Path("fragment.e4xmi"));

Eclipse Projectdependency on multiple src directories

today I have a special problem which already took me a while at the debugger.
I have two projects Project A and Project B.
Project A has multiple src-directories.
src
├───main
│ └───java
└───generated
└───java
both are recognized by eclipse as actual src directories. Both will be compiled to bin which looks like this:
bin
├───main
└───generated
Project B has a Project-dependencie on Project A.
And now comes the strange part: When I look for a class from Project A/src/main/java via Class.forName() inside Project B it will be found. When i look for a class from Project A/src/generated/java I get a ClassNotFound exception.
I would be very glad if you could point out a way to tell eclipse to create a dependencie on both src-directories.
btw, just in case it is important: I am using java 9.
and here is an excerpt of .classpath from Project B
<classpathentry kind="src" path="/Project A"/>
Thanks for your help.
This looks like a bug of Eclipse, Gradle or a combination of both. Try to delete the run configuration and restart the application. Make also sure the gradle.build file is in sync with the Eclipse project. If all this doesn't help, you can use a single output folder as workaround:
Manually in Project > Properties: Java Build Path, in the tab Source:
Uncheck the checkbox Allow output folders for source folders
In the field Default output folder enter bin/main
or via following gradle.build snippet:
apply plugin: 'eclipse'
eclipse.classpath.file.whenMerged {
entries.find { it.path == 'src/main/java' }.output = 'bin/main'
entries.find { it.path == 'src/generated/java' }.output = 'bin/main'
}

Eclipse build.properties Warning: The plug-in's classpath library '.' does not have a corresponding source build entry

For the build.properties file in Eclipse I get the warning
The plug-in's classpath library '.' does not have a corresponding source build entry
The build.properties file has the following content:
bin.includes = .settings/,\
META-INF/,\
.,\
Processes/,\
Resources/,\
Schemas/,\
Service Descriptors/,\
.WebResources/,\
pom.xml,\
target/
What am I missing here?
The . entry in the bin.includes is the entry for the plugn's main source code. The build needs to know where to look for that source code. For a plugin using a src directory for the source you need
source.. = src/
in the build.properties to provide that information.
You might also need
output.. = bin/
to say where the output classes are located.

JXBrowser Bundle: This license can only be used with Bound to class name

I'm trying to bundle JXBrowser into an OSGI plugin but I keep getting an invalid license error. The error output with my teamdev.licenses file info is:
-- Product name: JxBrowser
-- Licensed version: 6.x
-- Licensed to:
-- License type: Development
-- License bound to product: Bound to class name
-- Generation date: Apr 12, 2017
-- Expiration date: NEVER
-- License info: Open Source Project
-- Current date: Aug 24, 2017
JxBrowser license check failed: This license can only be used with Bound to class name
I have JXBrowser successfully loading in eclipse via Maven, but I need to know how to bind the license to my classname, in this case org.brettjsettle.internal.OpenExternalAppTask. The JXBrowser website says:
The license.jar file that contains JxBrowser license isn't an OSGi bundle, so we recommend that you extract the teamdev.licenses file from the license.jar archive and put it into META-INF folder of the jxbrowser.jar file, so that license checker could find it.
Since I'm fetching JXBrowser through Maven, I just pasted teamdev.licenses in my src/main/resources/META-INF folder. I've tried adding lines to the licenses file but that results in Signature is not valid
Am I missing something? How do I bind the license to a class name?
Thanks
The error message in the output indicates that the license you have is bound to a specific class name which isn't included into your application class path.
When you obtained the license file from JxBrowser Sales Team, you should've provided them with the specific class in your application.
Please make sure that that class is in your application class path.
I needed to unzip the JXBrowser jar and manually add the licenses file to the META-INF directory, repackage the jar and install it to my maven locally. I guess I was just hoping that would be less work.
For anyone else, you can unzip the jar, add your license file, rejar it with jar cvfM jxbrowser-X.X.jar ./* from within the unzipped dir. Then install it to your local maven with:
mvn install:install-file -Dfile=jxbrowser-6.14.2.jar -DgroupId=com.teamdev.jxbrowser -DartifactId=chromium -Dversion=6.14.2 -Dpackaging=jar
mvn install:install-file -Dfile=jxbrowser-mac-6.14.2.jar -DgroupId=com.teamdev -DartifactId=jxbrowser.mac -Dversion=6.14.2 -Dpackaging=jar
Hope this was helpful to someone!

cant compile ast parser code in java

I have some ast parser code in eclipse but I am unable to import the
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
packages.
could some body tell me which jar file to download and where to add same that jar file in eclipse folder.
You probably have those files downloaded already in eclipse\plugins folder i.e. in windows C:\Program Files\eclipse\plugins\org.eclipse.jdt.core_3.9.1.v20130905-0837.jar
Of course you can download from internet as well
http://central.maven.org/maven2/org/eclipse/tycho/org.eclipse.jdt.core/
Note that in order to run it as a stand alone application you will have to import such librariers (where xx stands for version and again they can be found in eclipse\plugins folder):
org.eclipse.core.contenttype_xx.jar
org.eclipse.core.jobs_xx.jar
org.eclipse.core.resources_xx.jar
org.eclipse.core.runtime_xx.jar
org.eclipse.equinox.common_xx.jar
org.eclipse.equinox.preferences_xx.jar
org.eclipse.jdt.core_xx.jar
org.eclipse.osgi_xx.jar
Usually people add other libraries in folder called lib but still you will have to set it in eclipse. In order to do that right click on your project then build path -> configure build path -> libraries and select add JAR.