Maven创建web工程报错

1.Error: cannot change version of project facet dynamic web module to 3.0

1.1 修改web.xml

<?xml version="1.0" encoding="UTF-8"?>

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

        

1.2 找到工程目录,修改.setting/org.eclipse.wst.common.project.facet.core.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.7"/>
  <installed facet="jst.jsf" version="2.2"/>
  <installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

        直接手动修改jst.web对应的version即可。

        然后,项目右键-->Maven-->Update Project

2.Error: JavaServer Faces 2.2 can not be installed : One or more constraints have not been satisfied

        修改web.xml文件

<?xml version="1.0" encoding="UTF-8"?>

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

3.Error: JAX-RS (REST Web Services) 2.0 can not be installed : One or more constraints have not been satisfied

        修改pom.xml文件,在<build>中加入如下语句。

<build>
    <finalName>mvntest</finalName>
    
    <plugins>  
	<plugin>  
	    <groupId>org.apache.maven.plugins</groupId>  
	    <artifactId>maven-compiler-plugin</artifactId>  
	    <configuration>  
	    <source>1.7</source>  
	    <target>1.7</target>  
	    </configuration>  
	    </plugin>  
    </plugins>
</build>

        以上问题经常同时出现,暴力一点,把文件都改了,就没问题了。至于问题出现的原因,还没有深层的追究,希望各位大神能指点一下。

转载于:https://my.oschina.net/NorthOcean/blog/631479

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值