Drools Eclipse Plugin ignores source level - eclipse

I have installed the Drools Eclipse Plugin org.drools.eclipse 7.36.0.Final into my Eclipse 2020_03 running with a Oracle JDK 1.8.0_92. I have downloaded und unzipped drools-distribution-7.36.0.Final and added the binaries/ directory as Drools > Installed Drools Runtimes in the Eclipse Preferences.
As soon as I use any Java 1.5+ features (generics, foreach loops, closures, ...) I get error markers in the Rule Editor saying that there are syntax errors and those features require source level 1.5 (1.8 for closures).
My .drl files and the project itself seem to be fine, because I can compile and run via maven without errors. So it's not a blocking issue, but it's annoying that I cannot seem to get syntax checks for .drl files working properly in my IDE.
I have searched the internet and tried out all kinds of things:
I have set the JDT source levels in my project and workspace to 1.8
I have checked Installed JREs in the properties and only the one JDK 1.8.0_92 is listed
I have created a kmodule.xml file in /src/main/resources/META-INF/ with this content
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<configuration>
<property key="drools.dialect.java.compiler.lnglevel" value="1.8" />
<property key="drools.dialect.java.compiler" value="ECLIPSE" />
<property key="drools.compiler.lnglevel" value="1.8" />
</configuration>
<kbase name="rules">
<ksession name="codegen-rules"/>
</kbase>
</kmodule>
I have created a kie.properties.conf file in /src/main/resources/META-INF/ with this content:
drools.dialect.java.compiler.lnglevel=1.8
drools.dialect.java.compiler=ECLIPSE
drools.compiler.lnglevel=1.8
I have added the properties in the VM args section of my eclipse.ini file:
-Ddrools.dialect.java.compiler.lnglevel=1.8
-Ddrools.dialect.java.compiler=ECLIPSE
-Ddrools.compiler.lnglevel=1.8
But all of these do not seem to have any effect and it keeps giving me the same error markers.
How can I tell the Rule Editor that I want to enable Java 1.8 source level when syntax checking my .drl files?

I have run into this issue as well using the latest eclipse release and the latest drools release.
Using Eclipse 2019-03 and the Jboss Tools Integration Stack here does work. So either something broke in later eclipse releases or in the later drools versions. The integration stack uses 7.21.0.Final
I have not dug into what exactly broke but even if I did I don't know who I would report it to :(

Related

Disable annotation processing Maven Java EE Eclipse

We have a number of war projects in eclipse. When they are imported as maven projects, the annotation processing are automatically enabled.
Tried disabling the annotation processing by adding <proc>none</proc> to the maven-compiler-plugin. It doesn't help.
If preferences -> Maven -> Enable Java EE configuration is disabled, the annotation processing is NOT enabled (but then the modules can't be deployed). As soon as that option is checked, the maven update starts and the annotation processing is re-enabled.
All the modules affected are identified as J2EEModuleVirtualComponent show the same maven debug information:
YYY is a J2EEModuleVirtualComponent
Underlying resources for the root folder are :
-/YYY/src/main/java/
-/YYY/src/main/resources/
-/YYY/.apt_generated/
Is there a way to enable the Java EE configuration while disabling the annotation processing?
It turned out the annotations were being enabled by two plugins from the GWT eclipse plugin. To disable them I had to do the following:
Make a security copy of C:\Users\.p2\pool\artifacts.xml and remove the following entries (the versions might change depending on your GWT plugin). Depending on your installation the .p2 folder might be in the eclipse instead.
<artifact classifier='osgi.bundle' id='com.ibm.etools.javaee.cdi.ext.ui' version='1.2.300.v20171018_0400'>
<properties size='1'>
<property name='download.size' value='161017'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle' id='com.ibm.etools.javaee.cdi.ext.ui' version='1.2.0.v20150617_2241'>
<properties size='1'>
<property name='download.size' value='158451'/>
</properties>
</artifact>
Same for the entries in all the versions of C:\Users\.p2\pool\features\com.ibm.ws.st.jee.tools.feature: Backup the feature.xml and remove the "com.ibm.etools.javaee.cdi.ext.ui" and "com.ibm.etools.javaee.cdi.ext.ui" entries.
Restart your eclipse and verify in help->about eclipse->Installation details-> Plug-ins that "com.ibm.etools.javaee.cdi.ext.ui" and "com.ibm.etools.javaee.cdi.ext.ui" are no longer listed.
If you want to clean your work space, remove all the imported maven projects (not the parent ones) and execute the attached script from the root of the work space. This will delete all the generated files, and leave the projects as if they had been just imported from the repository. After that you can re-import the existing maven projects, and verify that no apt_generated folders are created or added to the paths, and annotation processing are disabled in all the the projects.
To verify automatically that no annotation processing has been enable, search your work space for "org.eclipse.jdt.apt.core.prefs" files and ".apt_generated" folders. There should be none.

Change to jdk 7 in eclipse(sts)

How do I switch project from JDK 6 to 7, I know I am not using it because switch doesn't accept String.
In build path I have jre 7 in compiler settings I have 1.7 , everywhere and it still doesn't work. I use Spring Tool Suite(Eclipse based) latest version which officially supports Java 7.
And in project facets I also have 1.7. Why it has to be so bloody difficult.
And in .ini I have perfectly correct C:\Program Files\Java\jdk1.7.0\bin\javaw.exe
-startup
And I am sure my IDE supports 7 because whenever I create new project I have not syntax errors with String switch statement.
And my JAVA HOME set to JDK 1.7 :-)
UPDATE: The problem only happens with projects of Spring nature.
UPDATE 2: Happens with template Spring MVC project, Spring Hibernate template apparently works with Java 7.
Totally confused.
When I start a new Java project in Eclipse Indigo, eclipse tells me that the compiler compliance level 1.7 is not supported:
It is not possible to change that from inside eclipse, the properties dialog shows that:
So as a result, it is not possible to use the new switch statement with Strings in it:
See the "Eclipse Forums Post" for more information about the topic. It seems that it will come only with the next eclipse version.
In window / preferences / Installed JREs you need to have the JDK1.7 as the default set up. Additionally in Project / Properties Java Compiler it should be also set (or disable the project specific settings)
UPDATE :
In my .settings folder there is a file called org.eclipse.wst.common.project.facet.core.xml
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
and contains some rather suspicious values. Not sure it matters, but worth trying to close the project change it then reopen the project. If that doesnt help then search for the string 1.6 in all files in your project
Compare .classpath and .project files between your simple Java projects and Spring projects. Sometimes the Nature or other project setting can be set differently.

Eclipse loops endlessly: Invoking 'Maven Project Builder'

Ugh! My Eclipse is stuck in an endless loop:
No operations to display at this time
Refreshing Workspace Building
Workspace. Invoking 'Maven Project Builder' on /MobileWebApp
The building workspace never gets past 58%.
Details:
Google's GWT provides a sample app MobileWebApp. They suggest adding it to Eclipse via File > Import > Checkout Maven projects from SCM.
I followed the instructions in this blog for adding the plugins for m2e, subclipse, and the m2e-subclipse connector.
After installing the plugins, I imported the sample project via File > Import > Checkout Maven projects from SCM and this URL.
The import seemed to complete ok and Eclipse doesn't display any markers. But now I have this endless refreshing and building and have no clue what is causing it or how to fix it.
Versions:
Eclipse Indigo 3.7
m2e 1.0.100
m2e connector for build-helper-maven-plugin 0.14
Maven SCM handler for Subclipse 0.13
Subclipse 1.6.18
Subclipse Client Adapter 1.6.12
Any advice is greatly appreciated.
I opened my module's .project file. There were two entries:
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>
I removed org.eclipse.m2e.core.maven2Builder entry and it magically fixed the problem.
I was able to resolve this by right clicking on the project and selecting Run As > Maven Clean
I was getting the same issue in an eclipse (Juno) Maven project that had nothing to do with GWT - it just kept refreshing and "Invoking Maven Project Builder". Going to the Progress view and requesting a cancellation of either progress entry (by clicking that red stop button on the right) didn't help.
The project the builder kept getting stuck on was always the same, and a couple of levels deep in a set of multi-pom maven projects in eclipse.
What eventually solved it for me was just going into that particular project's Properties > Builders and unchecking Maven Project Builder (but keeping the Java Builder checked so that it would still auto-build when code changed). I just ignored the warning about this being an "advanced operation" and possibly having "many side-effects" - I figured it couldn't be any more annoying than that constant build-refresh cycle. I'm still not sure what the cause of this loop was, but that stopped it for me. And I haven't had any problems since.
I actually solved the problem that was caused by the jaxb plugin. If the forceRegenerate is set to true you will get the build loop in eclipse (Kepler in my case).
Verify that you have forceRegenerate set to false in your maven-jaxb-plugin.
<configuration>
<forceRegenerate>false</forceRegenerate>
</configuration>
M2e, even in eclipse mars, seems to like infinite building.
In my case, no such thing as repeated build commands, as listed bellow.
The only thing that seems to work when the project tree is gigantic is:
open eclipse
Disable build automatically as soon as you open eclipse
refresh the workspace and trigger manual a Crtl+B or a build all.
Once eclipse is satisfied that it build the full project tree ... better have four core machine or you're gonna be waiting a while, you can finely put the build automatically option active. Eclipse seems not to go in a building spree after that. It will still go for a while scanning some folders, but activating the build automatically - once you've built it all before - is much faster than a new build all, and finally, eclipse becomes stable stops building infinitely.
Otherwise, you're stuck with the deprecated mvn eclipse:eclipse ...
and have to abandon the use of maven commands from within eclipse echosystem. M2e seems to have a really gigantic hard time cooperating with the beast.
I still use m2e, but must say it is 100 times more difficult to swallow m2e than maven integration in netbeans. On the otherhand, eclipse is much faster for very large code base. Pick your poison, you'll always get bitten.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>rootPom</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
The problem can be a code generating plugin like the openapi-generator-maven-plugin or the protoc-jar-maven-plugin. Such plugins are generating code that retriggers the eclipse compilation. A solution to prevent this behavior could be to disable the plugin for the Eclipse "Maven Project Builder". This can be done by adding an entry to the pom.xml like described here: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- Add plugin execution configuration here -->
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Such Plugin configuration could look like similar to the following example:
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<versionRange>[0.0,)</versionRange>
<goals>
<goal>generate</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
Alternatively such settings could be done globally for a eclipse workspace: Window > Preferences > Maven > Lifecycle Mappings.
More about this topic can be read here: https://www.benchresources.net/eclipse-maven-plugin-execution-not-covered-by-lifecycle-configuration/
This issue generally also comes when maven unable to delete some file may that is having too long name. So you can manually go to your target folder and clean it and restart eclipse.
it some times worked for me when i change my JAVA_HOME to a new location
I did something similar to Amos M. Carpenter response (https://stackoverflow.com/a/28713259/4470352)
But also I created a new custom builder with the following configuration:
Choose configuration type -> Program
Location (text box) <= D:\apache-maven-3.3.9\bin\mvn.cmd (my custom maven)
Working Directory (text box) <= ${workspace_loc:/project}
Arguments (text area)
<= clean compile test-DproxySet=true -DproxyHost=a.proxy.host -DproxyPort=8080
This compiles me the project with no progress bar, but i can see the progress in text console.
The problem in my case is that every time I compile that project, I download a WSDL and I need to provide proxy configuration. When maven project builder plug-in tries to compile my project, fails and starts again in a loop.
I have tried to setup it into settings.xml maven configuration file, but doesn't work for me, and providing proxy configuration in command line works.
So creating that custom builder does the job and is a new approach.
I hope it to helps you.
I have configured the java environment variable properly (i.e., JAVA_HOME).
Also added the jdk path to the environment variable path, in my case path is C:\Program Files\Java\jdk1.8.0_101\bin.
Also I added path to JDK home in "Installed JREs" preference in Eclipse.
Not sure which one of this resolved the issue, I don't see auto build happening now.
After this, I created a new maven project. Which was set to use the 1.7 by default, this project too resulted in endless loop. But 1.7 is not configured in eclipse. Updating the project properties to use the java version available in my eclipse has resolved the issue.
Eclipse on my workstation hangs every time I try to update maven project. The issue is not resolved even after trying a lot of resolutions/workarounds suggested by community. The only thing that works for me is to run mvn clean and install commands from command prompt. I end the task in task manager, run mvn commands and then re-launch eclipse. Running clean build after re-launching eclipse works fine.
I linked some files in eclipse but the source file was missing (deleted in the meantime). This caused eclipse to restart the build. Deleting the broken link solved the problem.
Delete project from eclipse(not from disk).
And import as "General>Existing Projects into Workspace"
This was happening to me after a project I cloned from GitHub changed its structure to multi-module Maven project. Since some eclipse-specific files were in .gitignore, doing git pull kept the originals even after I removed the old project from Eclipse and re-imported it as new with submodules. This apparently caused some chaos leading to the issue.
Nuking the project directory and re-cloning the project resolved the issue.
Eclipse -> Preferences -> Maven -> Installations
Remove additional installation and using EMBEDDED helped me.
The trigger was, that I wanted to have a separated maven setup for
SLF4J: Class path contains multiple SLF4J bindings.
In my case, I was working with react so running node using frontend plugin. If node is running then it stucks on Invoking 'Maven Project Builder'. I closed node and invoking was completed asap. Node instance running in eclipse was creating issue. I am using windows so going into task manager I closed node instances like shown in image and it works fine. You can check if there is any instance under eclipse which is causing issue.
I opened my module's .project file. There were two redundant entries and deleting one helped
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
I had the same problem. It turns out that I was running Eclipse with the pipe (|) operator, running another process in parallel. The other process was jamming my Eclipse thread. Once I shut down the other process, Eclipse worked fine.

Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?

I've got a GWT 1.6 project in Eclipse 3.4 and am trying to reference source from another (non-GWT) project in my workspace. I've added the project to my build path, but I can't run the application in hosted mode. When I do, I get a "no source code is available" error.
I've done some searching and reading and have tried a few things that others have suggested (including creating a jar from the dependent project and linking to it), but frankly nothing has worked.
If you're actually doing this, could you please help me out with a simple step-by-step setup? I'd really appreciate it, thanks!
I have 2 Eclipse Projects. One is gwt project and one is not. Here's the directory structure that works for me:
workspace
-- gwt-project
-- src/main/java
-- com.gwt.GwtProjectModule
-- GwtProjectModule.gwt.xml
-- non-gwt-project
-- src/main/java
-- com.nongwt.package.that.contains.source.you.need
-- nongwt.gwt.xml
-- com.nongwt.package.that.contains.source.you.need.client
nongwt.gwt.xml tells gwt to look inside "client" package, here's what it looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='nongwt'>
<inherits name='com.google.gwt.user.User' />
<source path="client" />
</module>
GwtProjectModule.gwt.xml can then inherit source code from nongwt. Here's the relevant line from inside GwtProjectModule.gwt.xml:
<inherits name="com.nongwt.package.that.contains.source.you.need.nongwt" />
Make sure you include non-gwt-project inside gwt-project's classpath in eclipse. It's the normal drill; right click on gwt-project, choose properties, choose "Java Build Path", click "Projects" tab, and "non-gwt-project"
Or, instead of including non-gwt-project in gwt-project's classpath as a project reference, you can also jar the contents of non-gwt--project, ensure that you include the source in the jar, and then include the jar in gwt-project's classpath.
Good Luck!
I know this post is quite old but as I spent quite a lot of time on this issue and finally found the way to do it, I thought I might share the answer :
once you've created your launch configuration, open it run>run configurations...
go to classpath tab and select user entries. add advanced>folder and select the source folder of your other module project. If as me you've separated the module conf file in a src/main/resources folder you have to add it as well.
should work.
The client-side code in your GWT project (the classes under the client package) can't reference any classes that aren't in a GWT module.
If you've got code in another project that you want to reference from client code in your GWT project, you need to:
Make sure it's all "GWT safe", which means it doesn't reference any JRE classes that aren't emulated by GWT (http://code.google.com/webtoolkit/doc/1.6/RefJreEmulation.html), or reference any classes that reference JRE classes not emulated
Make sure all referenced classes are within a GWT module. This means putting a MyOtherProject.gwt.xml file in your other project, and all the referenced classes must be under a client subpackage
Make your GWT project inherit from the other project. So add the following to your GWT project's gwt.xml module file:
<inherits name='com.yourCompany.otherProject.MyOtherProject' />
Boden: add the following to your module file
<source path=""></source>
in addition to your other sources, eg:
<source path=""></source>
<source path="com.acme.otherpackage"></source>
then the compiler won't complain.
Atleast that's how I solved it. Not sure if using path="" allows inclusion of everything, I'm assuming it's the default value when no sources are specified.
This is a fantastic solution of your problem proposed by Sven Buschbeck (must a norwegian, lol!), worked for me!
When work­ing on sev­eral large scale projects (in Eclipse), it’s con­ve­nient and of course more effi­cient to share and reuse code via com­mon libraries. While those are in an early stage they need to be changed a lot and there­fore it’s handy to link projects in instead of cre­at­ing new jars each time the library has been updated.
Unfor­tu­nately, this stan­dard approach for Java devel­op­ment in Eclipse does not work that straight for­ward as with plain old Java projects, it requires three steps in total:
Link the library project to all rel­e­vant projects (“Project
Pref­er­ences” -> “Java Build Path” -> “Projects” -> “Add…”)
Then, add the client-side code of the library (by adding it as a
mod­ule.) There­fore, edit the gwt.xml of your appli­ca­tion and add
for exam­ple
where Super­Lib is the file name of the gwt.xml file in you library
project and before that is the pack­age it lies in.
Add the code to the project by link­ing a source folder.
Unfor­tu­nately, this is required if you do not want to write an Ant
script to com­pile your appli­ca­tion. (If you pre­fer Ant check
this out) I don’t like the idea of using such a script because if
you for­get to run it each time you make changes, you will end up in
confusion—let’s go for the con­ve­nient, auto­matic way then.
Add a folder to your appli­ca­tion project; open the “advanced” sec­tion in the folder cre­ation dia­log, select “Link to alter­nate loca­tion” and pick the source folder (usu­ally “src”) of your library project. (Hint: if you work within a team using a ver­sion­ing sys­tem, you can cre­ate a vari­able for that folder and use this instead. This way, each of your col­leagues can put the library project in a dif­fer­ent folder and accom­mo­date for that by adjust­ing the vari­able :) )
Right click the folder, “Build Path” -> “Use as Source Folder”. Done.
Sur­pris­ingly, the GWT plu­gin for Eclipse does not honor the project link­ing, thus all the ref­er­ences need to be made explicit or you will end up with lots of the fol­low­ing: ClassNotFoundException.
GWT doesn't know about that other code because it is not in the client directory of your project. You need to add the source path for the other code to the .gwt.xml file. Just added it to the xml as follows
<source path="common" />
common is the directory where the extra code is for this example.
Check out the XML Element Reference section of this doc
In your gwt project, go to properties, Java build path, source, click "link source" and point to your non-gwt project source package that you wish to include.
Edit: Found a eclipse fix. Run config > Classpath > Advanced > Add folder > otherproject/src .
Reason: Eclipse adds the bin folders of exported projects. GWT needs the src folders.
Elaborating on my comment.
I am using gwt 2.8 on Eclipse Neon, Java 1.8.0_92. Referring to another project in eclipse fails to launch devmode, because it cannot find the source for referred files from the other project.
What worked:
Switched to 'ant devmode' completely. Made the following changes to build.xml:
<target name="gwtc" ...>
<java ...>
<classpath>
<pathelement location="src"/>
<pathelement location="../otherproject/src"/><!-- Added -->
...
...
<target name="devmode" ...>
<java ...>
<classpath>
<pathelement location="src"/>
<pathelement location="../otherproject/src"/><!-- Added -->
Now do a production build with 'ant' or start devmode with 'ant devmode'.
Other things I noticed
Using the method in the accepted answer, otherproject/src/foo.gwt.xml is picked up (complains if not available), and static values from classes are picked up. Nothing else is. Very weird.
I understand that the DevMode/gwtc executables pick up sources from their class path. So all that is needed is for eclipse to add referred projects to their class path. I was not able to achieve this but this seems possible. FIXED see top.

Eclipse - How can I change a 'Project Facet' from Tomcat 6 to Tomcat 5.5?

(Eclipse 3.4, Ganymede)
I have an existing Dynamic Web Application project in Eclipse. When I created the project, I specified 'Default configuration for Apache Tomcat v6' under the 'Configuration' drop down.
It's a month or 2 down the line, and I would now like to change the configuration to Tomcat 'v5.5'. (This will be the version of Tomcat on the production server.)
I have tried the following steps (without success):
I selected Targeted Runtimes under the Project Properties
The Tomcat v5.5 option was disabled and The UI displayed this message:
If the runtime you want to select is not displayed or is disabled you may need to uninstall one or more of the currently installed project facets.
I then clicked on the Uninstall Facets... link.
Under the Runtimes tab, only Tomcat 6 displayed.
For Dynamic Web Module, I selected version 2.4 in place of 2.5.
Under the Runtimes tab, Tomcat 5.5 now displayed.
However, the UI now displayed this message:
Cannot change version of project facet Dynamic Web Module to 2.4.
The Finish button was disabled - so I reached a dead-end.
I CAN successfully create a NEW Project with a Tomcat v5.5 configuration. For some reason, though, it will not let me downgrade' an existing Project.
As a work-around, I created a new Project and copied the source files from the old Project. Nonetheless, the work-around was fairly painful and somewhat clumsy.
Can anyone explain how I can 'downgrade' the Project configuration from 'Tomcat 6' to 'Tomcat 5'? Or perhaps shed some light on why this happened?
Thanks
Pete
This is kind of hacking eclipse and you can get into trouble doing this but this should work:
Open the navigator view and find that there is a .settings folder under your project expand it and then open the file: org.eclipse.wst.common.project.facet.core.xml you should see a line that says:
<installed facet="jst.web" version="2.5"/>
Change that to 2.4 and save.
Just make sure that your project isn't using anything specific for 2.5 and you should be good.
Also check your web.xml has the correct configuration:
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
This may be old but I tried and found the following in eclipse Galilio.
Open the navigator view and find that there is a .settings folder under your project expand it and then open the file: org.eclipse.wst.common.project.facet.core.Delete the content of this file and right click on the project and click on properties. Go to Project Facats in the popup window there you can click on runtime tabs and convert your project to the new facet you want.
if you are using Maven, then shutdown eclipse, then type >mvn eclipse:eclipse -Dwtpversion=2.0, and restart the eclipse.
Sorry it seems I can't post a comment without enough Rep so...
I think it's too difficult for eclipse to degrade safely to a lower standard because it can't really know if you've used something from the newer web standard. So if it just allows you do to that it could cause your program to fail on an older version.
You can always be backward compatible but not forwards compatible.
You can try to uncheck the facet, apply, change the value of the facet and check. It works for me in Eclipse Helios SR1.
So the main difference is that I do it with 'Dynamic Web Module'.
I hope it works for you too.
I saw the same thing, then I changed the web-app version value in the web.xml. Doing so could fix this for you.
If you are using maven you can generated the eclipse settings using the maven eclipse plugin.
For the jst.web version the Maven eclipse pluging takes into account the dependencies of the project. If you have a servlet api dependency defined :
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>6.0.32</version>
</dependency>
You jst.web parameter will be 6.0
<faceted-project>
...
<installed facet="jst.web" version="6.0"/>
...
</faceted-project>