Maven常见问题解决

问题1:

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Pathindex.jsp

解决方法:在pom.xml中添加如下依赖:

    <dependency>
    	<groupId>javax</groupId>
    	<artifactId>javaee-api</artifactId>
    	<version>7.0</version>
    </dependency>

然后保存工程。

问题2:


JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer


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

解决方法,在pom.xml的build标签中添加如下:

<plugins>    
            <plugin>    
                <groupId>org.apache.maven.plugins</groupId>    
                <artifactId>maven-compiler-plugin</artifactId>    
                <version>2.3.2</version>  <!--这句可以不要-->  
                <configuration>    
                    <source>1.8</source>    
                    <target>1.8</target>    
                    <encoding>UTF-8</encoding><!--这句可以不要-->  
                </configuration>    
            </plugin>    
</plugins>


问题3:

maven项目报如下错误:


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


JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer.mymaven


Cannot change version of project facet Dynamic Web Module to 2.3.


解决方法:修改web.xml文件,将原始文件的

[html]  view plain  copy
  1. <!DOCTYPE web-app PUBLIC  
  2.  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  
  3.  "http://java.sun.com/dtd/web-app_2_3.dtd" >  
  4.   
  5. <web-app>  
  6.   <display-name>Archetype Created Web Application</display-name>  
  7. </web-app>  
修改为:

[html]  view plain  copy
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  3.     xmlns="http://java.sun.com/xml/ns/javaee"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 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>  

然后保存pom.xml文档,右键项目->Maven->Update Project。


另一解决方法:


修改项目中.settings文件夹中的org.eclipse.wst.common.project.facet.core.xml文件,将<installed facet="jst.web" version="3.1"/>这项的version修改为与web.xml中的version值一致的。即图中的两个地方。


然后保存,更新项目。


问题4:

Archive for required library: 'D:/Maven/repository/org/springframework/spring-beans/4.2.0.RELEASE/spring-beans-4.2.0.RELEASE.jar' in project 'movie' cannot be read or is not a valid ZIP file

这应该是jar包损坏了。

解决方法:在http://www.mvnrepository.com/artifact/org.springframework/spring-beans/4.2.0.RELEASE下载新的jai包,然后复制到D:/Maven/repository/org/springframework/spring-beans/4.2.0.RELEASE目录下,替换原来的jar包。然后更新工程。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值