eclipse maven项目变为web项目
来源:互联网 发布:linux修复windows引导 编辑:程序博客网 时间:2024/05/18 03:46
问题原因:
用Eclipse创建Maven结构的web项目的时候选择了Artifact Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的,而一般现在都是用3.0,在Project Facets里面修改Dynamic web module为3.0的时候就会出现Cannot change version of project facet Dynamic web module to 3.0
解决办法:
这里用的jdk为1.7
1.把Servlet改成3.0,打开项目的web.xml
<?xml
version="1.0"
encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ ns/javaee/web-app_3_0.xsd"
id="schedule-console"
version="3.0">
2.修改项目的设置,在Navigator下打开项目.settings目录下的org.eclipse.jdt.core.prefs
把1.5改成1.7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
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.7
3. 打开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"/>
</faceted-project>
如果提示新的错误:“Dynamic Web Module 3.0 requires Java 1.6 or newer”
在pom.xml文件中添加以下代码后,更新maven后正常;
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
转载自:http://my.oschina.net/cloudcoder/blog/362949
- eclipse maven项目变为web项目
- eclipse maven web项目
- eclipse maven web项目
- Eclipse导入web项目变为java项目的解决办法
- Eclipse导入web项目变为java项目的解决办法
- 把项目变为web项目
- eclipse 配置maven web项目
- eclipse 配置maven web项目
- eclipse 配置maven web项目
- Maven构建Web项目(eclipse)
- Eclipse+Maven构建Web项目
- eclipse 配置maven web项目
- eclipse配置maven web项目
- eclipse配置maven web项目
- eclipse 创建maven web项目
- eclipse+maven搭建web项目
- Eclipse+Maven创建Web项目
- eclipse 配置maven web项目
- Arduino - 连接RS232串口设备(通过RS232转TTL转接口)
- iOS - layoutSubviews、drawRect、awakeFromNib和 loadNibNamed解释
- 关于java集合的遍历以及ConcurrentModificationException(并发操作异常)
- Android开发常用
- spring security异常
- eclipse maven项目变为web项目
- Android-Service
- java中反射机制和Class.forName、实例对象.class(属性)、实例对象getClass()的区别
- 冬至,祝福暖 爱至,心温暖
- Service笔记1
- implements Serializable有什么作用?
- oracle 安装出现文件找不到的错误
- Innodb的事务处理autocommit参数问题
- java通过DOM操作xml