<p>我们用Eclipse创建Maven结构的web项目的时候选择了Artifact Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的,而一般现在至少都是2.5,在Project Facets里面修改Dynamic web module为2.5的时候就会出现Cannot change version of project facet Dynamic web module to 2.5,如图:</p>
<p><img src="https://img-blog.csdn.net/20140807102719410?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc3RldmVndW9zaGFv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""><br>
</p>
<p>其实在右边可以看到改到2.5需要的条件以及有冲突的facets,解决这个问题的步骤如下:</p>
<p>1.把Servlet改成2.5,打开项目的web.xml,改之前:</p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 1083px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_1" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_1" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span><!DOCTYPE web-app PUBLIC </span></span></li><li class=""><span> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" </span></li><li class="alt"><span> "http://java.sun.com/dtd/web-app_2_3.dtd" <span class="tag">></span><span> </span></span></li><li class=""><span> </span></li><li class="alt"><span><span class="tag"><</span><span class="tag-name">web-app</span><span class="tag">></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">display-name</span><span class="tag">></span><span>Archetype Created Web Application</span><span class="tag"></</span><span class="tag-name">display-name</span><span class="tag">></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">web-app</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_1_6173603" name="code" class="html" style="display: none;"><!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
</pre><br>
<br>
<p></p>
<p>改后:</p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 1351px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_2" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_2" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">xml</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span> </span><span class="attribute">encoding</span><span>=</span><span class="attribute-value">"UTF-8"</span><span class="tag">?></span><span> </span></span></li><li class=""><span><span class="tag"><</span><span class="tag-name">web-app</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"2.5"</span><span> </span></span></li><li class="alt"><span> <span class="attribute">xmlns</span><span>=</span><span class="attribute-value">"http://java.sun.com/xml/ns/javaee"</span><span> </span></span></li><li class=""><span> <span class="attribute">xmlns:xsi</span><span>=</span><span class="attribute-value">"http://www.w3.org/2001/XMLSchema-instance"</span><span> </span></span></li><li class="alt"><span> <span class="attribute">xsi:schemaLocation</span><span>="http://java.sun.com/xml/ns/javaee </span></span></li><li class=""><span> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"<span class="tag">></span><span> </span></span></li><li class="alt"><span> </span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">display-name</span><span class="tag">></span><span>Archetype Created Web Application</span><span class="tag"></</span><span class="tag-name">display-name</span><span class="tag">></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">web-app</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_2_4505163" name="code" class="html" style="display: none;"><?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<display-name>Archetype Created Web Application</display-name>
</web-app>
</pre>
<p></p>
<p><br>
</p>
2.修改项目的设置,在Navigator下打开项目.settings目录下的org.eclipse.jdt.core.prefs
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 1629px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_3" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_3" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="attribute">eclipse.preferences.version</span><span>=</span><span class="attribute-value">1</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode</span><span>=</span><span class="attribute-value">enabled</span><span> </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.codegen.targetPlatform</span><span>=</span><span class="attribute-value">1</span><span>.5 </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.compliance</span><span>=</span><span class="attribute-value">1</span><span>.5 </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.assertIdentifier</span><span>=</span><span class="attribute-value">error</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.enumIdentifier</span><span>=</span><span class="attribute-value">error</span><span> </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.forbiddenReference</span><span>=</span><span class="attribute-value">warning</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.source</span><span>=</span><span class="attribute-value">1</span><span>.5 </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_3_4123479" name="code" class="html" style="display: none;">eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
</pre><br>
把1.5改成1.6
<p></p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 1889px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_4" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_4" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="attribute">eclipse.preferences.version</span><span>=</span><span class="attribute-value">1</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode</span><span>=</span><span class="attribute-value">enabled</span><span> </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.codegen.targetPlatform</span><span>=</span><span class="attribute-value">1</span><span>.6 </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.compliance</span><span>=</span><span class="attribute-value">1</span><span>.6 </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.assertIdentifier</span><span>=</span><span class="attribute-value">error</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.enumIdentifier</span><span>=</span><span class="attribute-value">error</span><span> </span></span></li><li class="alt"><span><span class="attribute">org.eclipse.jdt.core.compiler.problem.forbiddenReference</span><span>=</span><span class="attribute-value">warning</span><span> </span></span></li><li class=""><span><span class="attribute">org.eclipse.jdt.core.compiler.source</span><span>=</span><span class="attribute-value">1</span><span>.6 </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_4_5344978" name="code" class="html" style="display: none;">eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
</pre><br>
打开org.eclipse.wst.common.component
<p></p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 2149px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_5" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_5" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">xml</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span> </span><span class="attribute">encoding</span><span>=</span><span class="attribute-value">"UTF-8"</span><span class="tag">?></span><span> </span></span></li><li class=""><span><span class="tag"><</span><span class="tag-name">project-modules</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"moduleCoreId"</span><span> </span><span class="attribute">project-version</span><span>=</span><span class="attribute-value">"1.5.0"</span><span class="tag">></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-module</span><span> </span><span class="attribute">deploy-name</span><span>=</span><span class="attribute-value">"test"</span><span class="tag">></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/target/m2e-wtp/web-resources"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/webapp"</span><span> </span><span class="attribute">tag</span><span>=</span><span class="attribute-value">"defaultRootSource"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/WEB-INF/classes"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/java"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/WEB-INF/classes"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/resources"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">property</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"context-root"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"test"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">property</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"java-output-path"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"/test/target/classes"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"></</span><span class="tag-name">wb-module</span><span class="tag">></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">project-modules</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_5_3742578" name="code" class="html" style="display: none;"><?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="test">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="test"/>
<property name="java-output-path" value="/test/target/classes"/>
</wb-module>
</project-modules>
</pre><br>
把<span style="background-color:rgb(240,240,240)">project-version="1.5.0"改成</span>project-version="1.6.0"<br>
<br>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 2489px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_6" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_6" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=6&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">xml</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span> </span><span class="attribute">encoding</span><span>=</span><span class="attribute-value">"UTF-8"</span><span class="tag">?></span><span> </span></span></li><li class=""><span><span class="tag"><</span><span class="tag-name">project-modules</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"moduleCoreId"</span><span> </span><span class="attribute">project-version</span><span>=</span><span class="attribute-value">"1.6.0"</span><span class="tag">></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-module</span><span> </span><span class="attribute">deploy-name</span><span>=</span><span class="attribute-value">"test"</span><span class="tag">></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/target/m2e-wtp/web-resources"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/webapp"</span><span> </span><span class="attribute">tag</span><span>=</span><span class="attribute-value">"defaultRootSource"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/WEB-INF/classes"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/java"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">wb-resource</span><span> </span><span class="attribute">deploy-path</span><span>=</span><span class="attribute-value">"/WEB-INF/classes"</span><span> </span><span class="attribute">source-path</span><span>=</span><span class="attribute-value">"/src/main/resources"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">property</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"context-root"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"test"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">property</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"java-output-path"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"/test/target/classes"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"></</span><span class="tag-name">wb-module</span><span class="tag">></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">project-modules</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_6_6915924" name="code" class="html" style="display: none;"><?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.6.0">
<wb-module deploy-name="test">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="test"/>
<property name="java-output-path" value="/test/target/classes"/>
</wb-module>
</project-modules>
</pre><br>
打开org.eclipse.wst.common.project.facet.core.xml
<p></p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 2803px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_7" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_7" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=7&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">xml</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span> </span><span class="attribute">encoding</span><span>=</span><span class="attribute-value">"UTF-8"</span><span class="tag">?></span><span> </span></span></li><li class=""><span><span class="tag"><</span><span class="tag-name">faceted-project</span><span class="tag">></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">fixed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"wst.jsdt.web"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"java"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.5"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"jst.web"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"2.3"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"wst.jsdt.web"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">faceted-project</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_7_4724097" name="code" class="html" style="display: none;"><?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
</pre><br>
把<installed facet="java" version="1.5"/>改成<installed facet="java" version="1.6"/>,把 <installed facet="jst.web" version="2.3"/>改成 <installed facet="jst.web" version="2.5"/>
<p></p>
<p></p>
<div class="dp-highlighter bg_html"><div class="bar"><div class="tools"><b>[html]</b> <a href="#" class="ViewSource" title="view plain" οnclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" target="_blank">view plain</a><span data-mod="popu_168"> <a href="#" class="CopyToClipboard" title="copy" οnclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" target="_blank">copy</a><div style="position: absolute; left: 740px; top: 3071px; width: 24px; height: 13px; z-index: 99;"><embed id="ZeroClipboardMovie_8" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_8" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=8&width=24&height=13" wmode="transparent" width="24" align="middle" height="13"></div></span><span data-mod="popu_169"> <a href="#" class="PrintSource" title="print" οnclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" target="_blank">print</a></span><a href="#" class="About" title="?" οnclick="dp.sh.Toolbar.Command('About',this);return false;" target="_blank">?</a></div></div><ol start="1" class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">xml</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span> </span><span class="attribute">encoding</span><span>=</span><span class="attribute-value">"UTF-8"</span><span class="tag">?></span><span> </span></span></li><li class=""><span><span class="tag"><</span><span class="tag-name">faceted-project</span><span class="tag">></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">fixed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"wst.jsdt.web"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"java"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.6"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"jst.web"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"2.5"</span><span class="tag">/></span><span> </span></span></li><li class=""><span> <span class="tag"><</span><span class="tag-name">installed</span><span> </span><span class="attribute">facet</span><span>=</span><span class="attribute-value">"wst.jsdt.web"</span><span> </span><span class="attribute">version</span><span>=</span><span class="attribute-value">"1.0"</span><span class="tag">/></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">faceted-project</span><span class="tag">></span><span> </span></span></li></ol></div><pre code_snippet_id="444667" snippet_file_name="blog_20140807_8_929087" name="code" class="html" style="display: none;"><?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.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
</pre><br>
都改好之后在打开看看,已经把Dynamic web module改成了2.5
<p></p>
<p><img src="https://img-blog.csdn.net/20140807104008413?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc3RldmVndW9zaGFv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""><br>
</p>
<p><br>
好了,大功搞成,这是一种解决办法,但是治标不治本,更高级的就是自定义catalog,然后安装到本地,再创建的时候啥都有了,比如把现在流行的s(struts2)sh,ssi,s(springmvc)sh 创建catalog,包括包结构,部分代码啥的都有,下次写吧。</p>
<p><br>
</p>