How to fix Cannot change version of project facet Dynamic Web Module to 3.1 Error in Eclipse

  • 13 February 2017
  • ADM

 

How to fix Cannot change version of project facet Dynamic Web Module to 3.1 Error in Eclipse - images/logos/eclipse.jpg

 

Not only once I got this error when I need to change the Servlet version "Cannot change version of project facet Dynamic Web Module to 3.1"

How to fix Cannot change version of project facet Dynamic Web Module to 3.1 Error in Eclipse - /images/DynamicWebModuleError001.png

Step 1 - find workspace location (optional)

If you don't know where is your workspace located follow these steps:

  • right click on the project;
  • Click on Resource
  • Go to your Location

How to fix Cannot change version of project facet Dynamic Web Module to 3.1 Error in Eclipse - /images/DynamicWebModuleError002.png

My case: D:\Repositories\Bitbucket\admfactory.com\JerseyHelloWorld

Step 3 - Edit org.eclipse.wst.common.project.facet.core.xml file

Edit <project_location>\.settings\org.eclipse.wst.common.project.facet.core.xml and change the jst.web property to 3.1.

<?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>

Step 4 - Refresh and Clean

Right-click on the project and refresh followed by Project -> Clean ... to recompile the project.

Step 5 - Check the project facets

Going back to project properties now it should be 3.1.

How to fix Cannot change version of project facet Dynamic Web Module to 3.1 Error in Eclipse - /images/DynamicWebModuleError003.png

These steps will work for any dynamic web module version.