【cl】maven新建web项目

我的环境:window32位 +jdk1.7.0_75+maven3.3.3

1.ctrl+N 新建maven project项目

 

2.选择maven-archetype-webapp

【这里一开始用all calalogs我是报错的,后面通过配置maven》archetypes的maven ctlalogs,然后选择maven catalogs 参考我的博客《新建maven web工程报错》】

 

3.填写信息

 

方法二的第二步:

2.选择maven-archetype-webapp

方法二的第三步:

3.填写信息

 

4.然后下一步:发现index.jsp有错误

解决办法:右击web项目》build path》java build path》libraries》Add library》Server Runtime》选择

然后回到Java Build Path选择Order and Export

设置后就ok了,jsp不会再有红叉

注意:若打开Server Runtime一片空白是需要先配置apache

设置方法为:window》preperences》Server》Runtime Environment》add》选择对应的版本

 

5、新建maven WEB项目的web.xml里面是没有指定欢迎页面的,需要手动加一下。加后的配置如下。
<!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>
 
  <welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

</web-app>

6、eclipse中配置调试服务容器
打开servers视图。Window -> Show View -> Other

进入视图选择对话框,选择Server->Servers 点击OK确定。

servers视图就被加载到控制台的位置

右键》new

 

 

进入项目添加、移除对话框。显示在这里的项目都是WEB项目,如果在新建maven项目的时候没有选择为webapp项目,在该对话框中就不会出现mavenWeb可选项目。

http://blog.csdn.net/clj198606061111/article/details/20221133

这时候server配置基本完了,但是如果这时候选择服务启动,服务启动不成功。

警告:[SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property'source' to 'org.eclipse.jst.j2ee.server:mavenWeb' did not find a matchingproperty.
7、双击刚刚新加的那个服务

12、在浏览器里面输入地址:http://localhost:8080/clMavenWeb   便可看到首页里面的内容了。

自此,eclipse中maven web项目tomcat调试环境配置已经完成。
 

 


 

 

posted @ 2015-12-15 23:01  dieyaxianju  阅读(287)  评论(0编辑  收藏  举报