Validation Errors on Eclipse RCP Application with xtext language - eclipse-rcp

I use an language developed with xtext in my eclipse rcp application. When I import a project containing files from this language I have
can't resolve reference ...
errors for nearly every element in every file. When I open these files inside the editor, it seems the validation runs again. I got only black error markers(I have no idea where they come from) on the site of the file but no error underlining since no errors are available. I can now validate this file again and the black markers disapear and the marker in the project explorer does also.
This behaviour seems like an unfinished validation in the project initialization. Does anybody know about this problem or maybe has an idea where I could've messed this up?
Here are the builder and nature configured in the .project file:
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>

Related

Eclipse doesn't clean or build any projects

I'm running Eclipse Neon. Whenever I click on any of my projects and try to click clean or build it doesn't allow me to - it is greyed out. It doesn't matter if I make any changes to the code or do anything else, it never gives me the option to clean/build.
It seems you have only general projects without builders: right-click on a project and choose Properties. In the Properties for ... dialog, in Builders look if there any builder listed. Without builders, your projects are probably configured incorrectly.
Builders (executed when project files are changed, e. g. incremental Java compiler) and natures (specifie which tooling is available) are set/stored in the .project file (which are hidden in the Projects/Packages Explorer view, but shown in the Navigator view and which can be edit with a text or XML editor). For example, the .project file of the plain Java project with the name and project folder Foo has the following content:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Foo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
If available, you may try right-click on a project and choose: Configure > Configure and detect nested projects...

mavenize eclipse wtp project (Dynamic web module) for openshift

Managed to publish my project in Openshift - by scp'ing the war to the correct location as detailed here. Here is the .project file:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DataCollectionServlet</name>
<comment></comment>
<projects></projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments></arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments></arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments></arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
Runs locally on glassfish and Jboss - in OpenShift I only have the jbossas gear
Now I want to properly set it up so it is build when I do a git push. Do I need to mavenize the project ? I installed the m2e plugin but "Convert to maven project" did not transfer the dependencies (there are project dependencies and custom jar ones as well as logback and co) and did not create a "maven" folder structure.
Do I have to create a particular folder structure ? Do I need to set up build hooks manually ?
Eclipse Luna, Java EE pack
OpenShift uses the pom.xml file to compile and publish your java project. You should try creating a java project on OpenShift, and git clone it locally, then read through the pom.xml file and see what components that you need for it to work. It would be worth doing that and then converting your project into that maven structure that OpenShift uses. It is important to have/leave the openshift profile at the end of the pom.xml as that is what tells your gear where to put your .war file after it is built.

Eclipse automatic build for custom projects

In Eclipse while creating the new Java Project (with our own custom wizards) I have associated a new builder to the project. Now the created java project has JavaNature and two builders associated with it.
org.eclipse.jdt.core.javabuilder
com.company.project.custombuilder
The .project file contents looks like this.
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/.externalToolBuilders/com.company.project.custombuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
I have to automate the building of this eclipse project.
If it is simple Java Project i can export the project as Ant Script and run the corresponding build.xml from ant.
Now my question is :
What are the different possibilities to automate my custom builder? Any clues will greatly help me.
Thanks in Advance.
Builders are sort of hard to find in the Eclipse documentation, but the information is there. Below are some links. Essentially the builds are triggers by resource change notifications from the workspace.
http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/guide/resAdv_builders.htm?
http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.user/gettingStarted/qs-96_non_ant_pjs.htm
http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_core_resources_builders.html

projects in workspace not showing up under project -> clean

Sometimes when launching eclipse my projects in my workspace do not show up in project -> clean. How can i fix this problem?
Things i have tried:
Closing projects and re-opening
deleting projects and re-importing
closing and re-launching eclipse
restarting computer
refreshing workspace and repeating any of those steps
Sometimes number 2 will work and sometimes it will not. This is a really annoying problem any assistance is greatly appreciated!
I have defined custom ant builds for all the projects. I unselected all the other builders besides my custom builder. Some projects are are showing up and some are not.
A project only shows up in the Clean dialog, if it has some kind of builder registered. You can check this by opening the project properties, and look for the Builders tab. If there are no builders, then it should not be visible.
If that is the problem, then you should try to identify at what point does your .project file in the project folder changed; that might give a hint about the culprit.
Closing eclipse and re-opening eclipse a few times solves the problem. It also seems that turning build automatically on and then closing eclipse and re-opening seems to help.
Eclipse... =)
Added the below lines between in <buildSpec> tag in .project file of the project and showed up in the clean. I am using eclipse Juno.
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
You must have the core builder in your .project file and the I believe the project nature setup or Eclipse will not show the project in the list of projects for the clean option from the file menu. That is the Project - clean that opens the clean dialog.
The project natures are used by Eclipse so that it knows what kind of project it is dealing with. I ran into the concept of project natures when I was trying to get a simple PERL project to run in Eclipse.
Here is an example that I used for Eclipse LUNA.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-war</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core</nature>
<nature>org.eclipse.wst.common.moduleCore.ModuleCoreNature</nature>
</natures>
</projectDescription>
I also found that for an angularjs project we were using Maven with, all that was needed was this under the buildSpec and natures for eclipse to see it as a project that could be cleaned:
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>

Eclipse: How to move the .externalToolBuilders directory?

I have built a small External Tool Builders for 3 eclipse projects.
How can I tell eclipse to use a (shared) directory outsite of the project directory?
I figgerd out that eclipse stores that settings in the .project file. But it seems that it is not possible to change the value:
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/.externalToolBuilders/do cleanup.launch</value>
</dictionary>
</arguments>
</buildCommand>
I tied the values:
<project>/../MyUtils/ExternalToolBuilders/do cleanup.launch
../MyUtils/ExternalToolBuilders/do cleanup.launch
x:/full/path/to/file/do cleanup.launch
Try this:
<dictionary>
<key>LaunchConfigHandle</key>
<value><?xml version="1.0" encoding="UTF-8"?><launchConfiguration local="false" path="/MyUtils/ExternalToolBuilders/docleanup.launch"/></value>
</dictionary>