Eclipse Plug-In Dependencies Vanished - eclipse

I am developing OSGi in Eclipse, and the plugin dependices has vanished for a project.
I have checked .classpath, and it seems fine:
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
I have tried starting eclipse with -clean and I have tried creating a new workspace and importing the projects into that workspace - no luck with either.
Any ideas? :)

Some strange eclipse bug. Re-edited the manifest file, and the dependencies reappeared and the project successfully compiled.

In case anyone still encounters this issue, the solution that worked for me eventually was (on Eclipse 4.3)
Delete the org.eclipse.pde.core.prefs file under the .settings folder in the plugin project
Remove/Delete the project from the workspace
Re-import the project back into the workspace
This should fix the Plug-in Dependencies entries for that project.
Hope it helps!

Check that you defined a valid target platform in Eclipse.
Go to Window -> Preferences -> Plug-in Development -> Target Platform.
When importing the plugin it was set to an empty target platform, you can verify this by first edit the selected target, then selecting the content tab of the target platform, it's empty.
I changed the Target Platform to 'Running Platform (Active)'.
This imported the necessary libs in the project, they were added to the plugin dependencies.
You can also opt to define your own custom target platform but that needs some more work and knowledge.

The .classpath file is for Java builder only. Dependencies are in META-INF/MANIFEST.MF

Related

Adding external folder jar in to build path

In my RCP plugin application, earlier having a folder at project level "neededJar" in which i have all external jar needed in project build
But now I want to put all jar at a common library say a lib folder in installation directory, at my workspace i added needed jar as project->build path->configure build path->add external jar it works but when I export the plugin project it is not able to resolve dependency.
I also tried to give it as class path variable but it did not work.
My classpath entry is as follow:
<classpathentry kind="var" path="MY_JAR"/>
<classpathentry kind="var" path="MY_JAR/MYClasses.jar"/>
<classpathentry kind="var" path="MY_JAR/jMYlex.jar"/>
<classpathentry kind="var" path="MY_JAR/MYsm.jar"/>
By digging i got to know, not sure about it I am missing some entry in Manifiest.MF and build properties.
Please count what are the steps that i am missing. Please suggest me through process to add external jar in plugin project
update: it is yet not answered well.
You could use a linked folder.
Create a new folder in your workspace, but open the "advanced" tab in the wizard. Chose "Link to alternate location".
Just be careful with references to folders outside your workspace, since they have a tendency to move from time to time :).

The project XXX does not have any GWT SDKs on its build path

Sometimes, when I start Eclipse (Java EE IDE for Web Developers, Indigo SR 1) on my MacOSX Lion, my GWT (2.4.0) project initially fails to compile.
Eclipse displays the following message in the "Problems" section:
The project XXX does not have any GWT SDKs on its build path
Here is a list of semi-solutions that sometimes work (I normally try them in this order):
Project > Clean.
Remove and re-add GWT SDK to the build path.
Restart the machine.
Any help with preventing the problem from re-occurring would be most welcome.
I encountered the same problems as described above. But none of the solutions worked.
What did work was moving the GWT SDK above the other GWT dependencies in the build path. See the following blog (written by my personal hero of the day):
Grant Little's Blog
I believe the problem was occurring because Eclipse had some stale settings about available/linked GWTs.
Therefore, building on the answer by Chris Cashwell, I recommend the following:
Remove all GWTs from your build path. (You might have more than one GWT on your build path.)
Remove all GWTs linked in Eclipse in Project>Properties>Google>Web Toolkit>Configure SDKs, .
Add only the latest GWT, and make it default.
EDIT: Sometimes, I still need to do a Project > Clean, but this is rare now.
I tried the above, but had to do a bit more:
From above:
Remove GWT SDK from my project
Remove all GWT SDKs from eclipse
Download new GWT SDK (2.5.0)
Add it to eclipse and to my project
What I did extra:
Edit the .classpath file of my project
Move the classpathentry for GWT to just under 'src'
Save the .classpath file
Close the project
Open the project
And that did it for me. Moving it in the Build Path GUI did not seem to work for me!
So, the start of my .classpath ended up looking like this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
etc...
Project->Properties->Java Build Path, find GWT SDK in this list, click Edit.
If Use default SDK is checked make sure the default is available. If not, click Configure SDKs... and make sure you don't have an x symbol on your SDK. If so, remove it and re-add it.
If Use specific SDK is checked, make sure you've selected one that is available.
In my case the GWT_CONTAINER was added below the JRE_CONTAINER.
Fixing this manually within my .classpath file solved the problem!
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Also an other soulutin is to move the GWT SDK to the top of the Library list(right after your project) on the Properties/Java Build Path/Order and Export page.
You could use maven for compilation and setting up your workspace.
However I guess this would be overkill for you.
There is a Maven GWT Plugin.

Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported

I'm getting this warning in Eclipse:
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result
After searching I found that I need fix export. I did it.
But this warning persists!
What else can be done to fix it?
Thanks.
You can right click on the warning, choose quickfix and choose one of the following:
Mark the associated raw classpath entry as a publish/export dependency.
Exclude the associated raw classpath entry from the set of potential publish/export dependencies.
As you will not have eclipse publishing/exporting the project it is safe to exclude it. But either way it makes no difference
Step by step screenshots:
http://publib.boulder.ibm.com/infocenter/radhelp/v8/index.jsp?topic=/com.ibm.javaee.doc/topics/tlooseclasspath.html
I had tried both of the options but only the latter is what you need:
Mark the associated raw classpath entry as a publish/export
dependency
Exclude the associated raw classpath entry from the set of potential
publish/export dependencies
If you export the dependency, refreshing the project configuration via Maven -> Update Project Configuration context menu will cause the warning to return. In this case you need to edit the .classpath file by hand:
<classpathentry kind="con" exported="true" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
Simply delete have the attribute exported="true" and confirm by refreshing the project configuration.
I had the same problem; it vanishes after including
<packaging>war</packaging>
in the pom. There was no packaging at all.
See this solution from Geert Schuring's blog:
On certain occasions Eclipse will present you with the following warning:
Classpath entry org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
So solve this, do the following:
Open the properties of the project that generates this warning
Click on “Java Build Path”
Click on the tab “Order and Export”
Enable “Maven Dependencies”
Click on “Ok”
Open the “Problems” view
Select the warning we are trying to solve, and press “Ctrl-1″
Click on “Ok”
The problem is now solved. It may take some time before the warning
disapears because the project needs to rebuild before it goes away.
I wasn't able to solve the problem with the quickfix in Eclipse Luna. The problem disappeared after removing the Project Facet "Dynamic Web _Module". In Windows -> Preferences -> Project Facets.
P.S. Packaging as War also solved the issued but it was suppoused to be a JAR and I was puzzled why some projects worked ok and some didn't.
And by the way, the warning was real. It caused a ClassNotFoundExceptions exceptions in the server that made it unsusable when other projects referenced this.
Simply right click on the warning and do a quick fix
You can then review the .classpath file changes from source control
I have a simple way to solve this problem:
Delete the project from your Eclipse.
Into the work space where the project is located.
Delete the items selected in the following image. Just leave src and pom.xml.
Re-import the project in your Eclipse.
None of the answers helped in my case. Every time I update the project, m2e will delete the entry from the .classpath file which disables the warnings.
I've now filed a bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537401
Most answers, including the currently accepted one, only provide a temporary solution to this issue: every time I chose Maven > Update Project… and leaving the option 'Update project configuration from pom.xml' on, the warning came back.
However, after installing m2e-wtp - Maven Integration for WTP in Eclipse 4.5 (Mars) and issuing Update Project… again, while leaving the option selected, the warning (and resulting error) went away.
I was in the same situation that Aaron Digulla.
I am learning Maven and noticed that this issue manifested when
I added a pom packaging line, for war
updated the project
removed said line and updated again
I noticed that the file ".settings/org.eclipse.wst.common.component" was one of the leftover files after this operation. When I removed this one in particular and updated the project, the Warning would go away and it wouldn't come back unless I repeated it all again.
Using Eclipse Photon, the configuration below fixed the problem for me:
Window > Preferences > Maven > Java EE Integration > Enable Java EE Configuration
Note that I disabled this option before receiving the warning
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
All other options may not be checked if you do not need them.
The warning does not reappear after a Maven update.
I had the same issue after updating my JDK in project and resolved it by replacing my .classpath file with previous one.
I noticed the following changes in my .classpath file
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
The second line was missing from above code
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
This line was missing
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
These lines were added so I manually removed them and it all worked again.
I had the same problem in a maven project with dynamic web project, but I solved it like this.
Right click on the project
Properties
Deployment Assembly and button "add".
Select Directive Type "Java Build Path Entries"
Select "Maven Dependecies" and select button finish
This way when the "war" file of the final project is created, all the "jar" files from the "Maven Dependencies" directory will be added.
Adding to the pom.xml:
<properties>
<java.version>1.8</java.version>
</properties>
helped me in this case and also with Dynamic Web Module and other issues.
I came across this issue too!
I Believe that eclipse adds the same deps twice.
once in the
Maven Dependencies
Group and another in the form of
M2_REPO/ ...
You must remove the last one in the
Properties -> Java Buil Path -> Libraries
for the error to dissapear!
That's the typical problem with maven projects configured in Eclipse that are changed its configuration or saved inappropriately.
Normally I'll edit my .classpath file and check the references for the build path, etc.
So in your case, I think you'll need to delete your classpathentry with those org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER reference inside.

how to get value of eclipse .classpath classpathentry

I am writing some eclipse plugin that will do some work for BlackBerry developers.
This is the .classpath file entry of my BB project:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/net.rim.ejde.BlackBerryVMInstallType/BlackBerry JRE 5.0.0"/>
Using this information is it possible (programmatically) to find out the exact location of the rim plugin on the disk ?
In my case I am looking for the following pass:
D:\WORK\eclipse-java-galileo-SR2-win32\eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25
But I need to find the pass from my Eclipse Plugin java code.
My second question is how can i get from code .classpath file of my BlackBerry project.
Regards,
Slavik.
You can get the classpath entries from your IJavaProject, which you can get from your IProject something like this:
IJavaProject javaProject = (IJavaProject) JavaCore.create(project);

How to filter deployed code when exporting EAR from eclipse?

I have a basic web application (dynamic web project in eclipse) with an associated EAR project. I am trying to make sure that my junit test code stays out of the deployment EAR file.
In my web project I have a source folder called "src" and one called "test". I need to keep the .class files from the "test" source folder OUT of the EAR when I export it using eclipse.
I know this is trivial using ant but seems impossible using eclipse.. right click project and export the ear file.. the test classes are always included.
If I manually edit the .setting/org.eclipse.wst.common.component.xml file to remove the tag associated with the test folder it works but if some other developers change anything related to the build path, it gets regenerated...
Am I missing something obvious.. I've googled like crazy to no avail.. checked eclipse's docs and am at a loss..
It doesn't seem to be directly possible, which is bizarre. Here's a couple of workarounds you could try.
Note I'd move the java files from the web project to a Java project (this is probably a good practice to follow anyway). Either way create another "test" Java project and move the test sources to that project. Your test project declares the "main" Java project as a dependency so it has access to the types for testing, but isn't included in the war, so the test classes won't be deployed.
Alternatively if you want to keep the sources in one project, you can configure the test project to use linked resources. I've posted another answer that shows how you can use linked resources to share source locations across projects. With this approach the test sources still aren't on the build path for the main project, so won't be bundled in the jar, but are physically located in the project so source control is simpler.
I'm doing something similar, except with PDE, Using Eclipse 3.7.
I am deploying Eclipse/OSGi plugins/bundles, and have two java source directories: src and test
I've tweaked the contents of two eclipse project files to separate test code from the build.
.classpath:
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry export="false" kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry export="false" kind="lib" path="/thirdparty/junit/junit.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
These changes were motivated by reading this
I don't know if this will apply to your situation, but I also had to modify a build.properties file, to exclude the results of compiling 'test' from the produced jar file.
source.optimizing.jar = src/
#This doesn't contain test/ because we don't want it in the build.
bin.includes = META-INF/,\
optimizing.jar
#The junit.jar is also exluded
When I build the entire project, the test files are completely absent.