本文翻译自:Cannot change version of project facet Dynamic Web Module to 3.0?
I am using maven to create a dynamic webapp in Eclipse. 我正在使用maven在Eclipse中创建动态webapp。 I added some folders like src/test/java
and src/test/resources
. 我添加了一些文件夹,如src/test/java
和src/test/resources
。 Also I changed the library in Java Build Path to obtain the JavaSE-1.7. 我还更改了Java Build Path中的库以获取JavaSE-1.7。 It's all OK up to here. 这一切都可以。
When I tried to change the Projects Facet Dynamic Web Module something went wrong. 当我尝试更改Projects Facet动态Web模块时出现问题。 I had change the Java to 1.7 in the same place. 我在同一个地方将Java更改为1.7。 And it still told me, cannot change version of project facet Dynamic Web Module to 3.0. 它还告诉我,无法将项目方面的动态Web模块版本更改为3.0。
I have changed everything that would effect the changing I think. 我已经改变了一切会影响我想的变化。
#1楼
参考:https://stackoom.com/question/1E2Rk/无法将项目方面动态Web模块的版本更改为
#2楼
I updated my web.xml
我更新了我的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 ... 然后只是Maven - >更新项目......
#3楼
Another way is to edit the project facet configuration file itself: org.eclipse.wst.common.project.facet.core.xml
另一种方法是编辑项目构面配置文件本身: 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"/>
将此行中的动态Web模块版本更改为3.0 - <installed facet="jst.web" version="2.5"/>
And then: 然后:
- Right-click on the project (in the Project Explorer panel). 右键单击项目(在Project Explorer面板中)。
- Select Maven » Update Project (or press Alt+F5 ) 选择Maven»更新项目 (或按Alt + F5 )
You'll find this file in the .settings
directory within the Eclipse project. 您将在Eclipse项目的.settings
目录中找到此文件。
#4楼
In my case the web.xml was referenced by a dtd. 在我的例子中,web.xml被dtd引用。 After I changed this to xsd reference like the one posted by Sydney it worked. 之后我将其更改为xsd引用,就像悉尼发布的那样,它起作用了。
#5楼
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. 诀窍是删除.settings
目录。
#6楼
you please open the Navigator view and following step 请打开导航器视图并执行以下步骤
- (Window > Show View > Other > General) 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", make the below changes and save the file. (窗口>显示视图>其他>常规)并发现项目下有.settings文件夹,展开它然后打开文件“org.eclipse.wst.common.project.facet.core.xml”,制作下面更改并保存文件。
- Change the dynamic web module version in this line to 2.5 - 将此行中的动态Web模块版本更改为2.5 -
- Change the Java version in this line to 1.5 or higher - . 将此行中的Java版本更改为1.5或更高版本 - 。