I am using maven to create a dynamic webapp in Eclipse. I added some folders like src/test/java
and src/test/resources
. Also I changed the library in Java Build Path to obtain the JavaSE-1.7. It's all OK up to here.
When I tried to change the Projects Facet Dynamic Web Module something went wrong. I had change the Java to 1.7 in the same place. And it still told me, cannot change version of project facet Dynamic Web Module to 3.0.
I have changed everything that would effect the changing I think.
Dynamic Web Module version correlates with Servlet API version . Ideally a Servlet is an object that receives a request and generates a response based on that request.
Step 1: Click Help -> Install New Software. Step 2: In Work with add http://download.eclipse.org/releases/oxygen. If you are using any other Eclipse product like Neon then replace oxygen with neon. Step 3: Now expand checkbox with name Web, XML, Java EE and OSGi Enterprise Development.
Another way is to edit the project facet configuration file itself: org.eclipse.wst.common.project.facet.core.xml
Change the dynamic web module version in this line to 3.0 - <installed facet="jst.web" version="2.5"/>
And then:
You'll find this file in the .settings
directory within the Eclipse project.
I updated my web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Servlet 3.0 Web Application</display-name>
</web-app>
and then just Maven -> Update Project ...
I think I had the same problem as you. My web.xml had version 2.5 while the project had the (right-click on Project-> Properties-> Project Facets->) Dynamic Web Module 2.3.
Although I tried to change the version from 2.3 to 2.5 ECLIPSE did not permit it. Solution: I removed the check mark under the heading Dynamic Web Module, I saved and I had Update Project. Automatically re-awakening is entering the box with the correct version. I use Eclipse Kepler.
p.s.: look at the comments of Jonathan just below, very useful.
Open org.eclipse.wst.common.project.facet.core.xml
file
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>
Change the version like this <installed facet="jst.web" version="3.1"/>
Just this worked to me.
I had the same issue and I even tried to remove the project and add it again. What did the trick was to remove the .settings
directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With