1. 程式人生 > >maven-web項目剛創建報錯:Description Resource Path Location Type JavaServer Faces 2.2 can not be installed : One or more cons

maven-web項目剛創建報錯:Description Resource Path Location Type JavaServer Faces 2.2 can not be installed : One or more cons

ati plugins tool com -a riff common margin led

技術分享圖片
解決:

問題描述:maven項目出現如下錯誤

JavaServer Faces 2.0 requires Dynamic Web Module 2.5 or newer..Maven Java EE Configuration Problem
JavaServer Faces 2.0 can not be installed : One or more constraints have not been satisfied..line 1 Maven Java EE Configuration Problem

解決方案:

首先,將webapp下的web.xml文件

1  <?xml version="1.0" encoding="UTF-8"
?> 2 <!-- <!DOCTYPE web-app 3 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 4 "http://java.sun.com/dtd/web-app_2_3.dtd">

替換為


1 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
2     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
4 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 5 version="3.0"> 6 <display-name>Archetype Created Web Application</display-name> 7 </web-app>

然後,關閉Eclipse,改項目下的.settings\org.eclipse.wst.common.project.facet.core.xml,將 版本改成為3.0,將成後是<installed facet="jst.web" version="3.0"/>,再啟動Eclipse.

最後,在Problems View的出錯提示右鍵選Quick Fix,再按提示確定就OK;或者,右鍵項目->Maven->Update Project

=====================

此時,問題一般解決。如還不能解決,嘗試在pom.xml中加入如下代碼:


 1     <build>
 2         <finalName>chm</finalName>
 3         <plugins>
 4             <plugin>
 5                 <artifactId>maven-compiler-plugin</artifactId>
 6                 <version>2.0.2</version>
 7                 <configuration>
 8                     <source>1.6</source>
 9                     <target>1.6</target>
10                 </configuration>
11             </plugin>
12         </plugins>
13     </build>


來源: https://www.cnblogs.com/jebeljebel/p/4421098.html

maven-web項目剛創建報錯:Description Resource Path Location Type JavaServer Faces 2.2 can not be installed : One or more cons